diff --git a/common/ran_context.h b/common/ran_context.h
index 8d6b02a31ea7f8fd671a4c4b6aa1cb4e2a8f5869..76f1b63e3da4db721ccb4dc353d12ce8246b590c 100644
--- a/common/ran_context.h
+++ b/common/ran_context.h
@@ -50,15 +50,20 @@
 
 #include "PHY/defs_L1_NB_IoT.h"
 #include "RRC/LITE/defs_NB_IoT.h"
+#include "RRC/NR/defs_NR.h"
 typedef struct {
   /// RAN context config file name
   char *config_file_name;
   /// Number of RRC instances in this node
   int nb_inst;
+  /// Number of NB_IoT RRC instances in this node
+  int nb_nb_iot_rrc_inst;
+  /// Number of NR RRC instances in this node
+  int nb_nr_inst;
   /// Number of Component Carriers per instance in this node
   int *nb_CC;
-  /// Number of NB_IoT instances in this node
-  int nb_nb_iot_rrc_inst;
+  /// Number of NR Component Carriers per instance in this node
+  int *nb_nr_CC;
   /// Number of MACRLC instances in this node
   int nb_macrlc_inst;
   /// Number of NB_IoT MACRLC instances in this node
@@ -85,6 +90,8 @@ typedef struct {
   struct eNB_RRC_INST_s **rrc;
   /// NB_IoT RRC context variables
   //struct eNB_RRC_INST_NB_IoT_s **nb_iot_rrc;
+  /// NR RRC context variables
+  struct gNB_RRC_INST_s **nr_rrc;
   /// MAC context variables
   struct eNB_MAC_INST_s **mac;
   /// NB_IoT MAC context variables
diff --git a/openair2/RRC/NR/L2_interface_NR.c b/openair2/RRC/NR/L2_interface_NR.c
new file mode 100644
index 0000000000000000000000000000000000000000..91834d9c9d64f4742cec1cd2b9d538a8ca9b8065
--- /dev/null
+++ b/openair2/RRC/NR/L2_interface_NR.c
@@ -0,0 +1,519 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file l2_interface.c
+ * \brief layer 2 interface, used to support different RRC sublayer
+ * \author Raymond Knopp and Navid Nikaein
+ * \date 2010-2014
+ * \version 1.0
+ * \company Eurecom
+ * \email: raymond.knopp@eurecom.fr
+ */
+
+#include "platform_types.h"
+//#include "openair_defs.h"
+//#include "openair_proto.h"
+#include "defs.h"
+#include "extern.h"
+//#include "mac_lchan_interface.h"
+//#include "openair_rrc_utils.h"
+//#include "openair_rrc_main.h"
+#include "UTIL/LOG/log.h"
+#include "rrc_eNB_UE_context.h"
+#include "pdcp.h"
+#include "msc.h"
+#include "common/ran_context.h"
+
+#ifdef PHY_EMUL
+#include "SIMULATION/simulation_defs.h"
+extern EMULATION_VARS *Emul_vars;
+extern eNB_MAC_INST *eNB_mac_inst;
+extern UE_MAC_INST *UE_mac_inst;
+#endif
+
+#if defined(ENABLE_ITTI)
+# include "intertask_interface.h"
+#endif
+
+#include "flexran_agent_extern.h"
+
+//#define RRC_DATA_REQ_DEBUG
+//#define DEBUG_RRC 1
+
+
+extern RAN_CONTEXT_t RC;
+
+//------------------------------------------------------------------------------
+int8_t
+mac_rrc_data_req(
+  const module_id_t Mod_idP,
+  const int         CC_id,
+  const frame_t     frameP,
+  const rb_id_t     Srb_id,
+  const uint8_t     Nb_tb,
+  uint8_t*    const buffer_pP,
+  const uint8_t     mbsfn_sync_area
+)
+//--------------------------------------------------------------------------
+{
+  asn_enc_rval_t enc_rval;
+  SRB_INFO *Srb_info;
+  uint8_t Sdu_size                = 0;
+  uint8_t sfn                     = (uint8_t)((frameP>>2)&0xff);
+
+
+#ifdef DEBUG_RRC
+  int i;
+  LOG_I(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
+#endif
+
+  eNB_RRC_INST *rrc;
+  rrc_eNB_carrier_data_t *carrier;
+  BCCH_BCH_Message_t *mib;
+
+
+    rrc     = RC.rrc[Mod_idP];
+    carrier = &rrc->carrier[0];
+    mib     = &carrier->mib;
+
+    if((Srb_id & RAB_OFFSET) == BCCH) {
+      if(RC.rrc[Mod_idP]->carrier[CC_id].SI.Active==0) {
+        return 0;
+      }
+
+      // All even frames transmit SIB in SF 5
+      AssertFatal(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1 != 255, 
+		  "[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP);
+
+      if ((frameP%2) == 0) {
+        memcpy(&buffer_pP[0],
+               RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
+               RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
+
+#if 0 //defined(ENABLE_ITTI)
+        {
+          MessageDef *message_p;
+          int sib1_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1;
+          int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
+
+          if (sib1_size > sdu_size) {
+            LOG_E(RRC, "SIB1 SDU larger than BCCH SDU buffer size (%d, %d)", sib1_size, sdu_size);
+            sib1_size = sdu_size;
+          }
+
+          message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
+          RRC_MAC_BCCH_DATA_REQ (message_p).frame    = frameP;
+          RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib1_size;
+          memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
+          memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
+                  RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
+                  sib1_size);
+          RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
+
+          itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
+        }
+#endif
+
+#ifdef DEBUG_RRC
+        LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP);
+
+        for (i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1; i++) {
+          LOG_T(RRC,"%x.",buffer_pP[i]);
+        }
+
+        LOG_T(RRC,"\n");
+#endif
+
+        return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
+      } // All RFN mod 8 transmit SIB2-3 in SF 5
+      else if ((frameP%8) == 1) {
+        memcpy(&buffer_pP[0],
+               RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
+               RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
+
+#if 0 //defined(ENABLE_ITTI)
+        {
+          MessageDef *message_p;
+          int sib23_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23;
+          int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
+
+          if (sib23_size > sdu_size) {
+            LOG_E(RRC, "SIB23 SDU larger than BCCH SDU buffer size (%d, %d)", sib23_size, sdu_size);
+            sib23_size = sdu_size;
+          }
+
+          message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
+          RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
+          RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib23_size;
+          memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
+          memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
+                  RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
+                  sib23_size);
+          RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
+
+          itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
+        }
+#endif
+
+#ifdef DEBUG_RRC
+        LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP);
+
+        for (i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23; i++) {
+          LOG_T(RRC,"%x.",buffer_pP[i]);
+        }
+
+        LOG_T(RRC,"\n");
+#endif
+        return(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
+      } else {
+        return(0);
+      }
+    }
+    if( (Srb_id & RAB_OFFSET ) == MIBCH) {
+
+        mib->message.systemFrameNumber.buf = &sfn;
+	enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
+					 (void*)mib,
+					 carrier->MIB,
+					 24);
+	LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded);
+	buffer_pP[0]=carrier->MIB[0];
+	buffer_pP[1]=carrier->MIB[1];
+	buffer_pP[2]=carrier->MIB[2];
+	AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+		     enc_rval.failed_type->name, enc_rval.encoded);
+	return(3);
+    }
+
+    if( (Srb_id & RAB_OFFSET ) == CCCH) {
+      LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
+
+      if(RC.rrc[Mod_idP]->carrier[CC_id].Srb0.Active==0) {
+        LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP);
+        return -1;
+      }
+
+      Srb_info=&RC.rrc[Mod_idP]->carrier[CC_id].Srb0;
+
+      // check if data is there for MAC
+      if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer
+        LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload);
+
+#if 0 // defined(ENABLE_ITTI)
+        {
+          MessageDef *message_p;
+          int ccch_size = Srb_info->Tx_buffer.payload_size;
+          int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
+
+          if (ccch_size > sdu_size) {
+            LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
+            ccch_size = sdu_size;
+          }
+
+          message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_CCCH_DATA_REQ);
+          RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
+          RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
+          memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE);
+          memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, Srb_info->Tx_buffer.Payload, ccch_size);
+          RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
+
+          itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
+        }
+#endif
+
+        memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size);
+        Sdu_size = Srb_info->Tx_buffer.payload_size;
+        Srb_info->Tx_buffer.payload_size=0;
+      }
+
+      return (Sdu_size);
+    }
+
+    if( (Srb_id & RAB_OFFSET ) == PCCH) {
+      LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
+
+      // check if data is there for MAC
+      if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer
+        LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area],
+               RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
+
+#if 0 //defined(ENABLE_ITTI)
+        {
+          MessageDef *message_p;
+          int pcch_size = RC.rrc[Mod_idP]->arrier[CC_id].sizeof_paging[mbsfn_sync_area];
+          int sdu_size = sizeof(RRC_MAC_PCCH_DATA_REQ (message_p).sdu);
+
+          if (pcch_size > sdu_size) {
+            LOG_E(RRC, "SDU larger than PCCH SDU buffer size (%d, %d)", pcch_size, sdu_size);
+            pcch_size = sdu_size;
+          }
+
+          message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_PCCH_DATA_REQ);
+          RRC_MAC_PCCH_DATA_REQ (message_p).frame = frameP;
+          RRC_MAC_PCCH_DATA_REQ (message_p).sdu_size = pcch_size;
+          memset (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, 0, PCCH_SDU_SIZE);
+          memcpy (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], pcch_size);
+          RRC_MAC_PCCH_DATA_REQ (message_p).enb_index = eNB_index;
+
+          itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
+        }
+#endif
+
+        memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
+        Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area];
+        RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0;
+      }
+
+      return (Sdu_size);
+    }
+
+#if defined(Rel10) || defined(Rel14)
+
+    if((Srb_id & RAB_OFFSET) == MCCH) {
+      if(RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESS[mbsfn_sync_area].Active==0) {
+        return 0;  // this parameter is set in function init_mcch in rrc_eNB.c
+      }
+
+
+#if 0 // defined(ENABLE_ITTI)
+      {
+        MessageDef *message_p;
+        int mcch_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area];
+        int sdu_size = sizeof(RRC_MAC_MCCH_DATA_REQ (message_p).sdu);
+
+        if (mcch_size > sdu_size) {
+          LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", mcch_size, sdu_size);
+          mcch_size = sdu_size;
+        }
+
+        message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_MCCH_DATA_REQ);
+        RRC_MAC_MCCH_DATA_REQ (message_p).frame = frameP;
+        RRC_MAC_MCCH_DATA_REQ (message_p).sdu_size = mcch_size;
+        memset (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, 0, MCCH_SDU_SIZE);
+        memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu,
+                RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
+                mcch_size);
+        RRC_MAC_MCCH_DATA_REQ (message_p).enb_index = eNB_index;
+        RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area;
+
+        itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
+      }
+#endif
+
+      memcpy(&buffer_pP[0],
+             RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
+             RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
+
+#ifdef DEBUG_RRC
+      LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP);
+
+      for (i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; i++) {
+        LOG_T(RRC,"%x.",buffer_pP[i]);
+      }
+
+      LOG_T(RRC,"\n");
+#endif
+
+      return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
+      //      }
+      //else
+      //return(0);
+    }
+
+#endif //Rel10 || Rel14
+
+#ifdef Rel14
+    if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR){
+        memcpy(&buffer_pP[0],
+               RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR,
+               RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
+        return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
+    }
+
+    if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR){ // First SI message with SIB2/3
+        memcpy(&buffer_pP[0],
+               RC.rrc[Mod_idP]->carrier[CC_id].SIB23_BR,
+               RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
+        return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
+    }
+
+#endif
+
+
+  return(0);
+}
+
+//------------------------------------------------------------------------------
+int8_t
+mac_rrc_data_ind(
+  const module_id_t     module_idP,
+  const int             CC_id,
+  const frame_t         frameP,
+  const sub_frame_t     sub_frameP,
+  const rnti_t          rntiP,
+  const rb_id_t         srb_idP,
+  const uint8_t*        sduP,
+  const sdu_size_t      sdu_lenP,
+  const uint8_t         mbsfn_sync_areaP
+)
+//--------------------------------------------------------------------------
+{
+  SRB_INFO *Srb_info;
+  protocol_ctxt_t ctxt;
+  sdu_size_t      sdu_size = 0;
+
+  /* for no gcc warnings */
+  (void)sdu_size;
+
+  /*
+  int si_window;
+   */
+  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0);
+
+    Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
+    LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id);
+    
+#if 0 //defined(ENABLE_ITTI)
+    {
+      MessageDef *message_p;
+      int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu);
+
+      if (sdu_lenP > msg_sdu_size) {
+        LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size);
+        sdu_size = msg_sdu_size;
+      } else {
+        sdu_size = sdu_lenP;
+      }
+
+      message_p = itti_alloc_new_message (TASK_MAC_ENB, RRC_MAC_CCCH_DATA_IND);
+      RRC_MAC_CCCH_DATA_IND (message_p).frame     = frameP;
+      RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP;
+      RRC_MAC_CCCH_DATA_IND (message_p).rnti      = rntiP;
+      RRC_MAC_CCCH_DATA_IND (message_p).sdu_size  = sdu_size;
+      RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
+      memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
+      memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
+      LOG_D(RRC,"[eNB %d] Sending message to RRC task\n",module_idP);
+      itti_send_msg_to_task (TASK_RRC_ENB, ctxt.instance, message_p);
+    }
+#else
+
+    //    msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id);
+    if (sdu_lenP > 0) {
+      memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
+      Srb_info->Rx_buffer.payload_size = sdu_lenP;
+      rrc_eNB_decode_ccch(&ctxt, Srb_info, CC_id);
+    }
+
+#endif
+
+  return(0);
+
+}
+
+//------------------------------------------------------------------------------
+int
+mac_eNB_get_rrc_status(
+  const module_id_t Mod_idP,
+  const rnti_t      rntiP
+)
+//------------------------------------------------------------------------------
+{
+  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
+  ue_context_p = rrc_eNB_get_ue_context(
+                   RC.rrc[Mod_idP],
+                   rntiP);
+
+  if (ue_context_p != NULL) {
+    return(ue_context_p->ue_context.Status);
+  } else {
+    return RRC_INACTIVE;
+  }
+}
+
+void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
+			    const int CC_idP,
+			    const frame_t frameP,
+			    const sub_frame_t subframeP,
+			    const rnti_t rntiP)
+{
+  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
+  ue_context_p = rrc_eNB_get_ue_context(
+                   RC.rrc[Mod_instP],
+                   rntiP);
+
+  if (ue_context_p != NULL) {
+    LOG_I(RRC,"Frame %d, Subframe %d: UE %x UL failure, activating timer\n",frameP,subframeP,rntiP);
+    if(ue_context_p->ue_context.ul_failure_timer == 0)
+      ue_context_p->ue_context.ul_failure_timer=1;
+  }
+  else {
+    LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP);
+  }
+  if (rrc_agent_registered[Mod_instP]) {
+    agent_rrc_xface[Mod_instP]->flexran_agent_notify_ue_state_change(Mod_instP,
+								     rntiP,
+								     PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
+  }
+//  rrc_mac_remove_ue(Mod_instP,rntiP);
+}
+
+void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP,
+                const int CC_idP,
+                const frame_t frameP,
+                const sub_frame_t subframeP,
+                const rnti_t rntiP)
+{
+    struct rrc_eNB_ue_context_s* ue_context_p = NULL;
+    ue_context_p = rrc_eNB_get_ue_context(
+                     RC.rrc[Mod_instP],
+                     rntiP);
+    if (ue_context_p != NULL) {
+      LOG_I(RRC,"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer\n",frameP,subframeP,rntiP);
+
+      if(ue_context_p->ue_context.ul_failure_timer == 0)
+          ue_context_p->ue_context.ul_failure_timer=19999;
+    }
+    else {
+      LOG_W(RRC,"Frame %d, Subframe %d: U-Plane failure: UE %x unknown \n",frameP,subframeP,rntiP);
+    }
+}
+
+void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP, 
+			    const int CC_idP, 
+			    const frame_t frameP,
+			    const sub_frame_t subframeP,
+			    const rnti_t rntiP)
+{
+  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
+  ue_context_p = rrc_eNB_get_ue_context(
+                   RC.rrc[Mod_instP],
+                   rntiP);
+
+  if (ue_context_p != NULL) {
+    LOG_I(RRC,"Frame %d, Subframe %d: UE %x to UL in synch\n",
+          frameP, subframeP, rntiP);
+    ue_context_p->ue_context.ul_failure_timer = 0;
+  } else {
+    LOG_E(RRC,"Frame %d, Subframe %d: UE %x unknown \n",
+          frameP, subframeP, rntiP);
+  }
+}
diff --git a/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-InterNodeDefinitions.asn b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-InterNodeDefinitions.asn
new file mode 100755
index 0000000000000000000000000000000000000000..13cbb9258444b5cc4477adc5a1a9078e871aed0d
--- /dev/null
+++ b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-InterNodeDefinitions.asn
@@ -0,0 +1,282 @@
+NR-InterNodeDefinitions DEFINITIONS AUTOMATIC TAGS ::=
+ 
+BEGIN
+
+-- TAG-HANDOVER-COMMAND-START
+
+HandoverCommand ::=					SEQUENCE {
+	criticalExtensions					CHOICE {
+		c1									CHOICE{
+			handoverCommand					HandoverCommand-IEs,
+			spare3 NULL, spare2 NULL, spare1 NULL
+		},
+		criticalExtensionsFuture			SEQUENCE {}
+	}
+}
+
+HandoverCommand-IEs ::=				SEQUENCE {
+	handoverCommandMessage				OCTET STRING (CONTAINING RRCReconfiguration),
+	nonCriticalExtension				SEQUENCE {}							OPTIONAL
+}
+
+-- TAG-HANDOVER-COMMAND-STOP
+-- TAG-HANDOVER-PREPARATION-INFORMATION-START
+
+HandoverPreparationInformation ::=	SEQUENCE {
+	criticalExtensions					CHOICE {
+		c1									CHOICE{
+			handoverPreparationInformation		HandoverPreparationInformation-IEs,
+			spare3 NULL, spare2 NULL, spare1 NULL
+		},
+		criticalExtensionsFuture			SEQUENCE {}
+	}
+}
+
+HandoverPreparationInformation-IEs ::= SEQUENCE {
+	ue-CapabilityRAT-List				UE-CapabilityRAT-ContainerList,
+	sourceConfig						OCTET STRING (CONTAINING RRCReconfiguration),
+	rrm-Config							RRM-Config				OPTIONAL,
+	as-Context							AS-Context				OPTIONAL,
+	nonCriticalExtension				SEQUENCE {}				OPTIONAL
+}
+
+AS-Context ::=							SEQUENCE {
+	reestablishmentInfo						SEQUENCE {
+		sourcePhysCellId					PhysCellId,
+		targetCellShortMAC-I				ShortMAC-I,
+		additionalReestabInfoList			ReestabNCellInfoList					OPTIONAL
+	}																				OPTIONAL,
+	-- FFS Whether to change e.g. move all re-establishment info to Xx
+	configRestrictInfo					ConfigRestrictInfoSCG						OPTIONAL,
+	...
+}
+
+ReestabNCellInfoList ::=		SEQUENCE ( SIZE (1..maxCellPrep) ) OF ReestabNCellInfo
+
+ReestabNCellInfo::=	SEQUENCE{
+	cellIdentity							CellIdentity,
+	key-gNodeB-Star							BIT STRING (SIZE (256)),
+	shortMAC-I								ShortMAC-I
+}
+
+RRM-Config ::=				SEQUENCE {
+	ue-InactiveTime				ENUMERATED {
+									s1, s2, s3, s5, s7, s10, s15, s20,
+									s25, s30, s40, s50, min1, min1s20c, min1s40,
+									min2, min2s30, min3, min3s30, min4, min5, min6,
+									min7, min8, min9, min10, min12, min14, min17, min20,
+									min24, min28, min33, min38, min44, min50, hr1,
+									hr1min30, hr2, hr2min30, hr3, hr3min30, hr4, hr5, hr6,
+									hr8, hr10, hr13, hr16, hr20, day1, day1hr12, day2,
+									day2hr12, day3, day4, day5, day7, day10, day14, day19,
+									day24, day30, dayMoreThan30}		OPTIONAL ,
+	candidateCellInfoList		CandidateCellInfoList		OPTIONAL,
+	...
+}
+
+-- TAG-HANDOVER-PREPARATION-INFORMATION-STOP
+-- TAG-CG-CONFIG-START
+
+CG-Config ::=					SEQUENCE {
+	criticalExtensions					CHOICE {
+		c1									CHOICE{
+			cg-Config					CG-Config-IEs,
+			spare3 NULL, spare2 NULL, spare1 NULL
+		},
+		criticalExtensionsFuture			SEQUENCE {}
+	}
+}
+
+CG-Config-IEs ::=			SEQUENCE {
+	scg-CellGroupConfig					OCTET STRING (CONTAINING RRCReconfiguration)	OPTIONAL,
+	scg-RB-Config						OCTET STRING (CONTAINING RadioBearerConfig)		OPTIONAL,
+	configRestrictModReq				ConfigRestrictModReqSCG							OPTIONAL,
+	drx-InfoSCG							DRX-Info										OPTIONAL,
+	candidateCellInfoListSN				OCTET STRING (CONTAINING CandidateCellInfoList)	OPTIONAL,
+	measConfigSN						MeasConfigSN									OPTIONAL,
+	selectedBandCombinationNR			BandCombinationIndex							OPTIONAL,
+	nonCriticalExtension				SEQUENCE {}										OPTIONAL
+}
+
+MeasConfigSN ::= SEQUENCE {
+	measuredFrequenciesFR1				SEQUENCE (SIZE (1..maxMeasFreqsMN))	OF NR-FreqInfo	OPTIONAL,
+	...
+}
+
+NR-FreqInfo ::= SEQUENCE {
+	measuredFrequency 					ARFCN-ValueNR									OPTIONAL,
+	...
+}
+
+ConfigRestrictModReqSCG ::=			SEQUENCE {
+	requestedBC-MRDC					BandCombinationIndex							OPTIONAL,
+	requestedBPC-ListMRDC				BPC-IndexList									OPTIONAL,
+	requestedP-MaxFR1				P-Max												OPTIONAL,
+	...
+}
+
+BandCombinationIndex ::= INTEGER (1..maxBandComb)
+
+-- TAG-CG-CONFIG-STOP
+-- TAG-CG-CONFIG-INFO-START
+
+CG-ConfigInfo ::=				SEQUENCE {
+	criticalExtensions				CHOICE {
+		c1								CHOICE{
+			cg-ConfigInfo				CG-ConfigInfo-IEs,
+			spare3 NULL, spare2 NULL, spare1 NULL
+		},
+		criticalExtensionsFuture		SEQUENCE {}
+	}
+}
+
+CG-ConfigInfo-IEs ::=		SEQUENCE {
+	ue-CapabilityInfo			OCTET STRING (CONTAINING UE-CapabilityRAT-ContainerList)		OPTIONAL,-- Cond SN-Addition
+	candidateCellInfoListMN			CandidateCellInfoList									OPTIONAL,
+	candidateCellInfoListSN			OCTET STRING (CONTAINING CandidateCellInfoList)			OPTIONAL,
+	measResultCellListSFTD			MeasResultCellListSFTD									OPTIONAL,
+	scgFailureInfo					SEQUENCE {
+		failureType						ENUMERATED { t310-Expiry, randomAccessProblem,
+														rlc-MaxNumRetx, scg-ChangeFailure, 
+														scg-reconfigFailure,
+														srb3-IntegrityFailure},
+		measResultSCG					OCTET STRING (CONTAINING MeasResultSCG-Failure)
+	}																						OPTIONAL,
+	configRestrictInfo			ConfigRestrictInfoSCG										OPTIONAL,
+	drx-InfoMCG					DRX-Info													OPTIONAL,
+	measConfigMN				MeasConfigMN												OPTIONAL,
+	sourceConfigSCG				OCTET STRING (CONTAINING RRCReconfiguration)				OPTIONAL,
+	scg-RB-Config             	OCTET STRING (CONTAINING RadioBearerConfig)        			OPTIONAL,
+	mcg-RB-Config				OCTET STRING (CONTAINING RadioBearerConfig)					OPTIONAL,
+	nonCriticalExtension		SEQUENCE {}													OPTIONAL
+}
+
+ConfigRestrictInfoSCG ::=		SEQUENCE {
+	allowedBC-ListMRDC				BandCombinationIndexList								OPTIONAL,
+	allowedBPC-ListMRDC				BPC-IndexList											OPTIONAL,
+	powerCoordination-FR1				SEQUENCE {
+		p-maxNR							P-Max												OPTIONAL,
+		p-maxEUTRA						P-Max												OPTIONAL
+	}																						OPTIONAL,
+	servCellIndexRangeSCG			SEQUENCE {
+		lowBound						ServCellIndex,
+		upBound							ServCellIndex
+	}																						OPTIONAL,   -- Cond SN-Addition
+	maxMeasFreqsSCG-NR					INTEGER(1..maxMeasFreqsMN)								OPTIONAL,
+	...
+}
+
+BandCombinationIndexList ::= SEQUENCE (SIZE (1..maxBandComb)) OF BandCombinationIndex
+
+BPC-IndexList ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BPC-Index
+BPC-Index ::= INTEGER (1..maxBasebandProcComb)
+
+DRX-Info ::=					SEQUENCE {
+	drx-LongCycleStartOffset		CHOICE {
+		ms10							INTEGER(0..9),
+		ms20							INTEGER(0..19),
+		ms32							INTEGER(0..31),
+		ms40							INTEGER(0..39),
+		ms60							INTEGER(0..59),
+		ms64							INTEGER(0..63),
+		ms70							INTEGER(0..69),
+		ms80							INTEGER(0..79),
+		ms128							INTEGER(0..127),
+		ms160							INTEGER(0..159),
+		ms256							INTEGER(0..255),
+		ms320							INTEGER(0..319),
+		ms512							INTEGER(0..511),
+		ms640							INTEGER(0..639),
+		ms1024							INTEGER(0..1023),
+		ms1280							INTEGER(0..1279),
+		ms2048							INTEGER(0..2047),
+		ms2560							INTEGER(0..2559),
+		ms5120							INTEGER(0..5119),
+		ms10240							INTEGER(0..10239)
+	},
+	shortDRX							SEQUENCE {
+		drx-ShortCycle						ENUMERATED	{
+												ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32,
+												ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, spare9,
+												spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 },
+		drx-ShortCycleTimer					INTEGER (1..16)
+	}																					OPTIONAL
+}
+
+MeasConfigMN ::= SEQUENCE {
+	measuredFrequenciesMN				SEQUENCE (SIZE (1..maxMeasFreqsMN))	OF NR-FreqInfo	OPTIONAL,
+	measGapConfigFR1					GapConfig											OPTIONAL,
+	gapPurpose							ENUMERATED {perUE, perFR1}							OPTIONAL,
+	...
+}
+
+
+-- TAG-CG-CONFIG-INFO-STOP
+-- TAG-MEASUREMENT-TIMING-CONFIGURATION-START
+
+MeasurementTimingConfiguration ::=				SEQUENCE {
+	criticalExtensions				CHOICE {
+		c1								CHOICE{
+			measTimingConf					MeasurementTimingConfiguration-IEs,
+			spare3 NULL, spare2 NULL, spare1 NULL
+		},
+		criticalExtensionsFuture		SEQUENCE {}
+	}
+}
+
+MeasurementTimingConfiguration-IEs ::=	SEQUENCE {
+	measTiming								MeasTimingList							OPTIONAL,
+	nonCriticalExtension					SEQUENCE {}								OPTIONAL
+}
+
+MeasTimingList ::= SEQUENCE (SIZE (1..maxMeasFreqsMN)) OF MeasTiming  
+
+MeasTiming ::= SEQUENCE {
+	carrierFreq								ARFCN-ValueNR							OPTIONAL,         
+	ssb-MeasurementTimingConfiguration		ENUMERATED {ffsTypeAndValue}		OPTIONAL,
+	...
+}
+
+-- TAG-MEASUREMENT-TIMING-CONFIGURATION-STOP
+-- TAG-CANDIDATE-CELL-INFO-LIST-START
+
+CandidateCellInfoList ::=	SEQUENCE (SIZE (1.. maxNrofSCells)) OF CandidateCellInfo
+
+CandidateCellInfo ::=			SEQUENCE {
+	cellIdentification				SEQUENCE {
+		physCellId						PhysCellId,
+		dl-CarrierFreq					ARFCN-ValueNR
+	},
+	measResultCell					MeasQuantityResults											OPTIONAL,
+	candidateRS-IndexListSSB		CandidateRS-IndexInfoListSSB								OPTIONAL,
+	candidateRS-IndexListCSI-RS		CandidateRS-IndexInfoListCSI-RS								OPTIONAL,
+	...
+}
+
+CandidateRS-IndexInfoListSSB ::=	SEQUENCE (SIZE (1..maxNrofIndexesToReport)) OF CandidateRS-IndexInfoSSB
+
+CandidateRS-IndexInfoSSB ::=	SEQUENCE {
+	ssb-Index						SSB-Index,
+	measResultSSB					MeasQuantityResults											OPTIONAL,
+	...
+}
+
+CandidateRS-IndexInfoListCSI-RS ::=	SEQUENCE (SIZE (1..maxNrofIndexesToReport)) OF CandidateRS-IndexInfoCSI-RS
+
+CandidateRS-IndexInfoCSI-RS ::=		SEQUENCE {
+	csi-RS-Index							CSI-RS-Index,
+	measResultCSI-RS						MeasQuantityResults									OPTIONAL,
+	...
+}
+
+-- TAG-CANDIDATE-CELL-INFO-LIST-STOP
+-- TAG_NR-MULTIPLICITY-AND-CONSTRAINTS-START
+
+maxMeasFreqsMN				INTEGER ::= 32	-- Maximum number of MN-configured measurement frequencies
+maxCellPrep					INTEGER ::= 32	-- Maximum number of cells prepared for handover
+
+-- TAG_NR-MULTIPLICITY-AND-CONSTRAINTS-STOP
+-- TAG_NR-INTER-NODE-DEFINITIONS-END-START
+
+END
+
diff --git a/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-RRC-Definitions.asn b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-RRC-Definitions.asn
new file mode 100755
index 0000000000000000000000000000000000000000..84426f50bb5ed9112bb03da3050b28217d19f3c7
--- /dev/null
+++ b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-RRC-Definitions.asn
@@ -0,0 +1,5480 @@
+NR-RRC-Definitions DEFINITIONS AUTOMATIC TAGS ::=
+ 
+BEGIN
+
+-- TAG-BCCH-BCH-MESSAGE-START
+
+BCCH-BCH-Message ::= SEQUENCE {
+	message											BCCH-BCH-MessageType
+}
+
+BCCH-BCH-MessageType ::= CHOICE {
+	mib												MIB,
+	messageClassExtension	SEQUENCE {}
+}
+
+-- TAG-BCCH-BCH-MESSAGE-STOP
+-- TAG-DL-DCCH-MESSAGE-START
+
+DL-DCCH-Message ::= SEQUENCE {
+	message											DL-DCCH-MessageType
+}
+
+DL-DCCH-MessageType ::= CHOICE {
+	c1						CHOICE {
+		rrcReconfiguration							RRCReconfiguration,
+		spare15 NULL, spare14 NULL, spare13 NULL,
+		spare12 NULL, spare11 NULL, spare10 NULL,
+		spare9 NULL, spare8 NULL, spare7 NULL,
+		spare6 NULL, spare5 NULL, spare4 NULL,
+		spare3 NULL, spare2 NULL, spare1 NULL
+	},
+	messageClassExtension	SEQUENCE {}
+}
+
+-- TAG-DL-DCCH-MESSAGE-STOP
+-- TAG-UL-DCCH-MESSAGE-START
+
+UL-DCCH-Message ::= SEQUENCE {
+	message											UL-DCCH-MessageType
+}
+
+UL-DCCH-MessageType ::= CHOICE {
+	c1						CHOICE {
+		measurementReport							MeasurementReport,
+		rrcReconfigurationComplete					RRCReconfigurationComplete,
+		spare14 NULL, spare13 NULL, spare12 NULL,
+		spare11 NULL, spare10 NULL, spare9 NULL,
+		spare8 NULL, spare7 NULL, spare6 NULL,
+		spare5 NULL, spare4 NULL, spare3 NULL,
+		spare2 NULL, spare1 NULL
+	},
+	messageClassExtension	SEQUENCE {}
+}
+
+-- TAG-UL-DCCH-MESSAGE-STOP
+-- TAG-MIB-START
+
+MIB ::= SEQUENCE {
+	-- The 6 most significant bit (MSB) of the 10 bit System Frame Number. The 4 LSB of the SFN are conveyed in the PBCH transport block 
+	-- as well but outside the MIB. 
+	systemFrameNumber					BIT STRING (SIZE (6)),
+
+	-- Subcarrier spacing for SIB1, Msg.2/4 for initial access and broadcast SI-messages.
+	-- If the UE acquires this MIB on a carrier frequency <6GHz, the values 15 and 30 kHz are applicable. 
+	-- If the UE acquires this MIB on a carrier frequency >6GHz, the values 60 and 120 kHz are applicable. 
+	subCarrierSpacingCommon				ENUMERATED {scs15or60, scs30or120},
+
+	-- The frequency domain offset between SSB and the overall resource block grid in number of subcarriers. (See 38.211, section 7.4.3.1)
+	-- Note: For frequencies <6 GHz a fith, this field may comprise only the 4 least significant bits of the ssb-SubcarrierOffset.
+	-- The codepoint "FFS_RAN1" indicates that this cell does not provide SIB1 and that there is hence no common CORESET.
+	ssb-SubcarrierOffset				INTEGER (0..15),
+
+	-- Position of (first) DL DM-RS. Corresponds to L1 parameter 'DL-DMRS-typeA-pos' (see 38.211, section 7.4.1.1.1)
+	dmrs-TypeA-Position					ENUMERATED {pos2, pos3},
+
+	-- Determines a bandwidth for PDCCH/SIB, a common ControlResourceSet (CORESET) a common search space and necessary PDCCH parameters.
+	-- Corresponds to L1 parameter 'RMSI-PDCCH-Config' (see FFS_Specification, section FFS_Section)
+	pdcch-ConfigSIB1					INTEGER (0..255), 
+
+	-- Indicates that UE shall not camp on this cell
+	cellBarred							ENUMERATED {barred, notBarred}, 
+	
+	-- Controls cell reselection to intra-frequency cells when the highest ranked cell is barred, or treated as barred by the UE, 
+	-- as specified in TS 38.304.
+	intraFreqReselection				ENUMERATED {allowed, notAllowed},
+	spare								BIT STRING (SIZE (1))
+}
+
+-- TAG-MIB-STOP
+-- TAG-MEASUREMENTREPORT-START
+
+MeasurementReport ::=				SEQUENCE {
+	criticalExtensions					CHOICE {
+		measurementReport							MeasurementReport-IEs,
+		criticalExtensionsFuture					SEQUENCE {}
+	}
+}
+
+MeasurementReport-IEs ::=		SEQUENCE {
+	measResults						MeasResults,
+
+	lateNonCriticalExtension				OCTET STRING															OPTIONAL,
+	nonCriticalExtension					SEQUENCE{}																OPTIONAL
+}
+
+-- TAG-MEASUREMENTREPORT-STOP
+-- TAG-RRCRECONFIGURATION-START
+
+RRCReconfiguration ::= 				SEQUENCE {
+	rrc-TransactionIdentifier			RRC-TransactionIdentifier,
+	criticalExtensions					CHOICE {
+		rrcReconfiguration					RRCReconfiguration-IEs,
+		criticalExtensionsFuture			SEQUENCE {}
+	}
+}
+
+RRCReconfiguration-IEs ::= 			SEQUENCE {
+	-- Configuration of Radio Bearers (DRBs, SRBs) including SDAP/PDCP. 
+    -- In EN-DC this field may only be present if the RRCReconfiguration
+	-- is transmitted over SRB3. 
+	radioBearerConfig						RadioBearerConfig 														OPTIONAL, -- Need M
+
+	-- Configuration of secondary cell group (EN-DC):
+	secondaryCellGroup						OCTET STRING (CONTAINING CellGroupConfig)								OPTIONAL, -- Need M
+
+	measConfig								MeasConfig																OPTIONAL, -- Need M
+
+	lateNonCriticalExtension				OCTET STRING															OPTIONAL,
+	nonCriticalExtension					SEQUENCE {}																OPTIONAL 
+}
+
+-- TAG-RRCRECONFIGURATION-STOP
+-- TAG-RRCRECONFIGURATIONCOMPLETE-START
+
+RRCReconfigurationComplete ::= 			SEQUENCE {
+	rrc-TransactionIdentifier				RRC-TransactionIdentifier,
+	criticalExtensions						CHOICE {
+		rrcReconfigurationComplete				RRCReconfigurationComplete-IEs,
+		criticalExtensionsFuture				SEQUENCE {}
+	}
+}
+
+RRCReconfigurationComplete-IEs ::= SEQUENCE {
+	lateNonCriticalExtension				OCTET STRING															OPTIONAL,
+	nonCriticalExtension					SEQUENCE {}																OPTIONAL 
+}
+
+-- TAG-RRCRECONFIGURATIONCOMPLETE-STOP
+-- TAG-SIB1-START
+
+SIB1 ::=		SEQUENCE {
+
+	-- FFS / TODO: Add other parameters. 
+
+	-- Frequency offset for the SSB of -5kHz (M=-1) or +5kHz (M=1). When the field is absent, the UE applies no offset (M=0).
+	-- The offset is only applicable for the frequency range 0-2.65GHz. Corresponds to parameter 'M' (see 38.101, section FFS_Section)
+	frequencyOffsetSSB				ENUMERATED {khz-5, khz5}																OPTIONAL,	-- Need R
+
+	-- Time domain positions of the transmitted SS-blocks in an SS-Burst-Set (see 38.213, section 4.1)
+	ssb-PositionsInBurst				SEQUENCE {
+		-- Indicates the presence of the up to 8 SSBs in one group
+		inOneGroup							BIT STRING (SIZE (8)),
+		-- For above 6 GHz: indicates which groups of SSBs is present
+		groupPresence						BIT STRING (SIZE (8))										OPTIONAL -- Cond above6GHzOnly
+	},
+
+	-- The SSB periodicity in msec for the rate matching purpose (see 38.211, section [7.4.3.1])
+	ssb-PeriodicityServingCell			ENUMERATED {ms5, ms10, ms20, ms40, ms80, ms160, spare1, spare2},
+
+	-- TX power that the NW used for SSB transmission. The UE uses it to estimate the RA preamble TX power. 
+	-- (see 38.213, section 7.4)
+	ss-PBCH-BlockPower					INTEGER (-60..50),
+
+	uplinkConfigCommon						UplinkConfigCommon											OPTIONAL,
+	-- FFS: How to indicate the FrequencyInfoUL for the SUL
+	supplementaryUplink					SEQUENCE {
+		uplinkConfigCommon					UplinkConfigCommon											OPTIONAL 
+		-- FFS: Add additional (selection) criteria determining when/whether the UE shall use the SUL frequency 
+	}																									OPTIONAL, -- Cond SUL
+
+	tdd-UL-DL-Configuration				TDD-UL-DL-ConfigCommon											OPTIONAL, -- Cond TDD
+	tdd-UL-DL-configurationCommon2		TDD-UL-DL-ConfigCommon											OPTIONAL, -- Cond TDD
+
+	pdcch-ConfigCommon					PDCCH-ConfigCommon												OPTIONAL,
+	pucch-ConfigCommon					PUCCH-ConfigCommon												OPTIONAL,
+
+	lateNonCriticalExtension				OCTET STRING															OPTIONAL,
+	nonCriticalExtension					SEQUENCE{}																OPTIONAL 
+}
+
+-- TAG-SIB1-STOP
+-- TAG-SETUP-RELEASE-START
+
+SetupRelease { ElementTypeParam } ::= CHOICE {
+	release			NULL,
+	setup			ElementTypeParam
+}
+
+-- TAG-SETUP-RELEASE-STOP
+-- TAG-ADDITIONALSPECTRUMEMISSION-START
+
+AdditionalSpectrumEmission ::=				INTEGER (0..7)
+
+-- TAG-ADDITIONALSPECTRUMEMISSION-STOP
+-- TAG-ALPHA-START
+
+Alpha ::=						ENUMERATED {alpha0, alpha04, alpha05, alpha06, alpha07, alpha08, alpha09, alpha1}
+
+-- TAG-ALPHA-STOP
+-- TAG-ARFCN-VALUE-NR-START
+
+ARFCN-ValueNR ::=				INTEGER (0..3279165)
+
+-- TAG-ARFCN-VALUE-NR-STOP
+-- TAG-BANDWIDTH-PART-START
+
+
+-- Generic parameters used in Uplink- and Downlink bandwidth parts
+BWP ::= 					SEQUENCE {
+	-- Frequency domain location and bandwidth of this bandwidth part defined commonly in a table (FFS_Section). The location is given as 
+	-- distance (in number of PRBs) to point A (absoluteFrequencyPointA in FrequencyInfoDL). 
+	-- Corresponds to L1 parameter 'DL-BWP-loc'. (see 38.211, section FFS_Section).		
+	-- In case of TDD, a BWP-pair (UL BWP and DL BWP with the same bwp-Id) must have the same location (see 38.211, section REF)
+	locationAndBandwidth			INTEGER (0..37949),
+	-- Subcarrier spacing to be used in this BWP for all channels and 
+	-- reference signals unless explicitly configured elsewhere.
+	-- Corresponds to subcarrier spacing according to 38.211, Table 4.2-1. 
+	-- The value kHz15 corresponds to µ=0, kHz30 to µ=1, and so on. Only the values 15 or 30 kHz  (<6GHz), 60 or 120 kHz (>6GHz) are 
+	-- applicable.
+	subcarrierSpacing				SubcarrierSpacing,
+	-- Indicates whether to use the extended cyclic prefix for this bandwidth part. If not set, the UE uses the normal cyclic prefix. 
+	-- Normal CP is supported for all numerologies and slot formats. Extended CP is supported only for 60 kHz subcarrier spacing. 
+	-- (see 38.211, section 4.2.2)
+	cyclicPrefix					ENUMERATED { extended }														OPTIONAL	-- Need R
+}
+
+BWP-Uplink ::= 			SEQUENCE {
+	-- An identifier for this bandwidth part. Other parts of the RRC configuration use the BWP-Id to associate themselves with a particular
+	-- bandwidth part. The BWP ID=0 is always associated with the initial BWP and may hence not be used here (in other bandwidth parts).
+	-- The NW may trigger the UE to swtich UL or DL BWP using a DCI field. The four code points in that DCI field map to the RRC-configured 
+	-- BWP-ID as follows: For up to 3 configured BWPs (in addition to the initial BWP) the DCI code point is equivalent to the BWP ID 
+	-- (initial = 0, first dedicated = 1, ...). If the NW configures 4 dedicated bandwidth parts, they are identified by DCI code 
+	-- points 0 to 3. In this case it is not possible to switch to the initial BWP using the DCI field.
+	-- Corresponds to L1 parameter 'UL-BWP-index'. (see 38.211, 38.213, section 12)
+	bwp-Id								BWP-Id,
+	bwp-Common							BWP-UplinkCommon														OPTIONAL,	-- Need M
+	bwp-Dedicated						BWP-UplinkDedicated														OPTIONAL,	-- Need M
+	...
+}
+
+BWP-UplinkCommon ::=				SEQUENCE {
+	genericParameters					BWP,
+	-- Configuration of cell specific random access parameters which the UE uses for contention based and contention free random access
+	-- as well as for contention based beam failure recovery. 
+	rach-ConfigCommon					SetupRelease { RACH-ConfigCommon }										OPTIONAL, 	-- Need M
+	-- Cell specific parameters for the PUSCH
+	pusch-ConfigCommon					SetupRelease { PUSCH-ConfigCommon }										OPTIONAL, 	-- Need M
+	
+	-- Cell specific parameters for the PUCCH
+	pucch-ConfigCommon					SetupRelease { PUCCH-ConfigCommon }										OPTIONAL, 	-- Need M
+	...
+}
+
+BWP-UplinkDedicated ::= 	SEQUENCE {
+	-- PUCCH configuration for one BWP of the regular UL or SUL of a serving cell. If the UE is configured with SUL, the network 
+	-- configures PUCCH only on the BWPs of one of the uplinks (UL or SUL).
+	pucch-Config						SetupRelease { PUCCH-Config }											OPTIONAL, 	-- Need M
+	-- PUSCH configuration for one BWP of the regular UL or SUL of a serving cell. If the UE is configured with SUL and
+	-- if it has a PUSCH-Config for both UL and SUL, a carrier indicator field in DCI indicates for which of the two to use an UL grant.
+	-- See also L1 parameter 'dynamicPUSCHSUL' (see 38.213, section FFS_Section)
+	pusch-Config						SetupRelease { PUSCH-Config }											OPTIONAL, 	-- Need M
+	-- A Configured-Grant of typ1 or type2. It may be configured for Ul or SUL but in case of type1 [FFS also type2] not for both at a time.
+	configuredGrantConfig				SetupRelease { ConfiguredGrantConfig }									OPTIONAL, 	-- Need M
+	-- Uplink sounding reference signal configuration
+	srs-Config							SetupRelease { SRS-Config }												OPTIONAL, 	-- Need M
+	-- Determines how the UE performs Beam Failure Recovery upon detection of a Beam Failure (see RadioLinkMonitoringConfig)
+	beamFailureRecoveryConfig			SetupRelease { BeamFailureRecoveryConfig }								OPTIONAL,	-- Need M
+	...
+}
+
+
+BWP-Downlink ::= 					SEQUENCE {
+	-- An identifier for this bandwidth part. Other parts of the RRC configuration use the BWP-Id to associate themselves with a particular
+	-- bandwidth part. The BWP ID=0 is always associated with the initial BWP and may hence not be used here. (in other bandwidth parts).
+	-- The NW may trigger the UE to swtich UL or DL BWP using a DCI field. The four code points in that DCI field map to the RRC-configured 
+	-- BWP-ID as follows: For up to 3 configured BWPs (in addition to the initial BWP) the DCI code point is equivalent to the BWP ID 
+	-- (initial = 0, first dedicated = 1, ...). If the NW configures 4 dedicated bandwidth parts, they are identified by DCI code 
+	-- points 0 to 3. In this case it is not possible to switch to the initial BWP using the DCI field.
+	-- Corresponds to L1 parameter 'DL-BWP-index'. (see 38.211, 38.213, section 12)
+	bwp-Id								BWP-Id,
+	bwp-Common							BWP-DownlinkCommon														OPTIONAL,	-- Need M
+	bwp-Dedicated						BWP-DownlinkDedicated													OPTIONAL,	-- Need M
+	...
+}
+
+
+BWP-DownlinkCommon ::=				SEQUENCE {
+	genericParameters					BWP,
+	pdcch-ConfigCommon					SetupRelease { PDCCH-ConfigCommon }										OPTIONAL,	-- Need M
+	pdsch-ConfigCommon					SetupRelease { PDSCH-ConfigCommon }										OPTIONAL,	-- Need M
+	...
+}
+
+BWP-DownlinkDedicated ::= 			SEQUENCE {
+	pdcch-Config						SetupRelease { PDCCH-Config }											OPTIONAL,	-- Need M
+	pdsch-Config						SetupRelease { PDSCH-Config }											OPTIONAL,	-- Need M 
+	sps-Config							SetupRelease { SPS-Config }												OPTIONAL, 	-- Need M
+	radioLinkMonitoringConfig			SetupRelease { RadioLinkMonitoringConfig }								OPTIONAL,	-- Need M
+	...
+}
+
+
+-- TAG-BANDWIDTH-PART-STOP 
+-- TAG-BWP-ID-START
+
+BWP-Id ::=							INTEGER (0..maxNrofBWPs)
+
+-- TAG-BWP-ID-STOP
+-- TAG-BEAM-FAILURE-RECOVERY-CONFIG-START
+
+BeamFailureRecoveryConfig ::= 		SEQUENCE {
+	rootSequenceIndex-BFR				INTEGER (0..137)															OPTIONAL,	--	Need M
+	-- Configuration of contention free random access occasions for BFR
+	rach-ConfigBFR						RACH-ConfigGeneric															OPTIONAL,	--	Need M
+	-- L1-RSRP threshold used for determining whether a candidate beam may be used by the UE to attempt contention free 
+	-- Random Access to recover from beam failure. The signalled threshold is applied directly for SSB, a threshold for 
+	-- CSI-RS is determined by linearly scaling singalled value based on Pc_ss corresponding to the CSI-RS resource.
+	-- (see FFS_Specification, FFS_Section)
+	candidateBeamThreshold		RSRP-Range																			OPTIONAL,	--	Need M
+	-- A list of reference signals (CSI-RS and/or SSB) identifying the candidate beams for recover and the associated RA parameters
+	candidateBeamRSList					SEQUENCE (SIZE(1..maxNrofCandidateBeams)) OF PRACH-ResourceDedicatedBFR		OPTIONAL,	--	Need M
+	-- Explicitly signalled PRACH Mask Index for RA Resource selection in TS 36.321. The mask is valid for all SSB resources
+	ra-ssb-OccasionMaskIndex			INTEGER (0..15)																OPTIONAL, 	--	Need M
+	-- Control Resource Set that the UE uses to receive the random access response for beam failure recovery. 
+	-- If the field is absent the UE uses the initial CORESET (ControlResourceSetId = 0)
+	recoveryControlResourceSetId		ControlResourceSetId														OPTIONAL	,	-- Need S
+	-- Search space to use for BFR RAR. If the field is absent, the UE uses the initial Serach Space (SearchSpaceId = 0).
+	recoverySearchSpaceId				SearchSpaceId																OPTIONAL,	-- Need S
+	...
+}
+
+PRACH-ResourceDedicatedBFR ::= 		CHOICE {
+	ssb									BFR-SSB-Resource,
+	csi-RS								BFR-CSIRS-Resource
+}
+
+BFR-SSB-Resource ::= 			SEQUENCE {
+	-- The ID of an SSB transmitted by this serving cell. It determines a candidate beam for beam failure recovery (BFR)
+	ssb								SSB-Index,
+	-- The preamble index that the UE shall use when performing BFR upon selecting the candidate beams identified by this SSB.
+	ra-PreambleIndex				INTEGER (0..63),
+	...
+}
+
+BFR-CSIRS-Resource ::=			SEQUENCE {
+	-- The ID of a NZP-CSI-RS-Resource configured in the CSI-MeasConfig of this serving cell. This reference signal determines a candidate beam
+	-- for beam failure recovery (BFR).
+	csi-RS							NZP-CSI-RS-ResourceId,
+	-- RA occasions that the UE shall use when performing BFR upon selecting the candidate beam identified by this CSI-RS. If the field is absent
+	-- the UE uses the RA occasion associated with the SSB that is QCLed with this CSI-RS. 
+	-- The RA preamble index to use in the RA occasions associated with this CSI-RS. If the field is absent, the UE uses the preamble index
+	-- associated with the SSB that is QCLed with this CSI-RS. 
+	ra-PreambleIndex				INTEGER (0..63)																	OPTIONAL,	-- Need R
+	...
+}
+
+-- TAG-BEAM-FAILURE-RECOVERY-CONFIG-STOP
+-- TAG-CELL-GROUP-CONFIG-START
+
+-- Configuration of one Cell-Group:
+CellGroupConfig	::= 						SEQUENCE {
+	cellGroupId									CellGroupId,
+
+	-- Logical Channel configuration and association with radio bearers:
+	rlc-BearerToAddModList 						SEQUENCE (SIZE(1..maxLC-ID)) OF RLC-Bearer-Config				OPTIONAL,   -- Need N
+	rlc-BearerToReleaseList						SEQUENCE (SIZE(1..maxLC-ID)) OF LogicalChannelIdentity			OPTIONAL,   -- Need N
+
+	-- Parameters applicable for the entire cell group:
+	mac-CellGroupConfig							MAC-CellGroupConfig												OPTIONAL,	-- Need M
+	physicalCellGroupConfig						PhysicalCellGroupConfig											OPTIONAL,	-- Need M
+
+	-- Serving Cell specific parameters (SpCell and SCells)
+	spCellConfig								SpCellConfig													OPTIONAL, 	-- Need M
+	sCellToAddModList							SEQUENCE (SIZE (1..maxNrofSCells)) OF SCellConfig				OPTIONAL,	-- Need N
+	-- List of seconary serving cells to be released (not applicable for SpCells)
+	sCellToReleaseList							SEQUENCE (SIZE (1..maxNrofSCells)) OF SCellIndex				OPTIONAL,	-- Need N
+	...
+}
+
+-- The ID of a cell group. 0 identifies the master cell group. Other values identify secondary cell groups.
+-- In this version of the specification only values 0 and 1 are supported.
+-- FFS: This should be moved to be own IE section
+CellGroupId ::=									INTEGER (0.. maxSecondaryCellGroups)
+
+
+RLC-Bearer-Config ::=								SEQUENCE {
+	-- ID used commonly for the MAC logical channel and for the RLC bearer.
+	logicalChannelIdentity						LogicalChannelIdentity,
+
+	-- Associates the RLC Bearer with an SRB or a DRB. The UE shall deliver DL RLC SDUs received via the RLC entity of this
+	-- RLC bearer to the PDCP entity of the servedRadioBearer. Furthermore, the UE shall advertise and deliver uplink PDCP PDUs of the 
+	-- uplink PDCP entity of the servedRadioBearer to the uplink RLC entity of this RLC bearer unless the uplink scheduling 
+	-- restrictions ('moreThanOneRLC' in PDCP-Config and the restrictions in LogicalChannelConfig) forbid it to do so.
+	servedRadioBearer							CHOICE {
+		srb-Identity                           SRB-Identity,
+		drb-Identity                           DRB-Identity
+	}																											OPTIONAL,	-- Cond LCH-SetupOnly
+
+	reestablishRLC								ENUMERATED {true}												OPTIONAL, 	-- Need N
+	rlc-Config									RLC-Config														OPTIONAL,	-- Cond LCH-Setup
+
+	mac-LogicalChannelConfig					LogicalChannelConfig											OPTIONAL,	-- Cond LCH-Setup
+	...	
+}
+
+LogicalChannelIdentity ::= 					INTEGER (1..maxLC-ID)
+
+-- Cell-Group specific L1 parameters
+PhysicalCellGroupConfig ::=					SEQUENCE {
+	-- Enables spatial bundling of HARQ ACKs. It is configured per cell group (i.e. for all the cells within the cell group) for PUCCH 
+	-- reporting of HARQ-ACK. It is only applicable when more than 4 layers are possible to schedule.
+	-- Corresponds to L1 parameter 'HARQ-ACK-spatial-bundling' (see 38.213, section FFS_Section)
+	-- Absence indicates that spatial bundling is disabled.
+	harq-ACK-SpatialBundlingPUCCH				ENUMERATED {true}												OPTIONAL,	-- Need R
+
+	-- Enables spatial bundling of HARQ ACKs. It is configured per cell group (i.e. for all the cells within the cell group) for PUSCH 
+	-- reporting of HARQ-ACK. It is only applicable when more than 4 layers are possible to schedule.
+	-- Corresponds to L1 parameter 'HARQ-ACK-spatial-bundling' (see 38.213, section FFS_Section)
+	-- Absence indicates that spatial bundling is disabled.
+	harq-ACK-SpatialBundlingPUSCH				ENUMERATED {true}												OPTIONAL,	-- Need R
+	-- The maximum transmit power to be used by the UE in this NR cell group. 
+	p-NR										P-Max															OPTIONAL,	-- Need R
+	-- The PDSCH HARQ-ACK codebook is either semi-static of dynamic. This is applicable to both CA and none CA operation.
+	-- Corresponds to L1 parameter 'HARQ-ACK-codebook' (see 38.213, section FFS_Section)
+	pdsch-HARQ-ACK-Codebook						ENUMERATED {semiStatic, dynamic},
+	-- RNTI used for SRS TPC commands on DCI. Corresponds to L1 parameter 'TPC-SRS-RNTI' (see 38.213, section 10)
+	tpc-SRS-RNTI								RNTI-Value														OPTIONAL,	-- Need R
+	-- RNTI used for PUCCH TPC commands on DCI. Corresponds to L1 parameter 'TPC-PUCCH-RNTI' (see 38.213, section 10).
+	tpc-PUCCH-RNTI								RNTI-Value														OPTIONAL,	-- Need R
+	-- RNTI used for PUSCH TPC commands on DCI. Corresponds to L1 parameter 'TPC-PUSCH-RNTI' (see 38.213, section 10)
+	tpc-PUSCH-RNTI	RNTI-Value																					OPTIONAL,-- Need R
+	...
+}
+
+
+-- Serving cell specific MAC and PHY parameters for a SpCell:
+SpCellConfig ::=						SEQUENCE {
+	-- Serving cell ID of a PSCell (the PCell of the Master Cell Group uses ID = 0)
+	servCellIndex						ServCellIndex															OPTIONAL,	-- Cond SCG
+	-- Parameters for the synchronous reconfiguration to the target SpCell:
+	reconfigurationWithSync 			ReconfigurationWithSync 												OPTIONAL,	-- Cond ReconfWithSync
+	rlf-TimersAndConstants				SetupRelease { RLF-TimersAndConstants }									OPTIONAL,	-- Need M
+	rlmInSyncOutOfSyncThreshold         INTEGER (0..1)                         									OPTIONAL,	-- Need M
+	spCellConfigDedicated				ServingCellConfig														OPTIONAL,	-- Need M
+	...
+}
+
+ReconfigurationWithSync ::=			SEQUENCE {
+	spCellConfigCommon					ServingCellConfigCommon													OPTIONAL,	-- Need M
+	newUE-Identity						RNTI-Value,
+	t304								ENUMERATED {ms50, ms100, ms150, ms200, ms500, ms1000, ms2000, ms10000},
+		rach-ConfigDedicated				CHOICE {
+			uplink								RACH-ConfigDedicated,
+			supplementaryUplink					RACH-ConfigDedicated
+	}																											OPTIONAL,	-- Need N
+	...
+}			
+
+SCellConfig ::=						SEQUENCE {
+	sCellIndex							SCellIndex,
+	sCellConfigCommon					ServingCellConfigCommon													OPTIONAL,	-- Cond SCellAdd
+	sCellConfigDedicated				ServingCellConfig														OPTIONAL,	-- Cond SCellAddMod
+	...
+}
+
+-- TAG-CELL-GROUP-CONFIG-STOP 
+-- TAG-CODEBOOKCONFIG-START
+CodebookConfig ::= 									SEQUENCE {
+	-- CodebookType including possibly sub-types and the corresponding parameters for each. Corresponds to L1 parameter 'CodebookType'
+	-- (see 38.214, section 5.2.2.2)
+	codebookType 										CHOICE {
+		type1 												SEQUENCE {
+			subType										CHOICE {
+				typeI-SinglePanel									SEQUENCE {
+					nrOfAntennaPorts									CHOICE {
+						two													SEQUENCE {
+							-- Codebook subset restriction for 2TX codebook 
+							-- Corresponds to L1 parameter ' TypeI-SinglePanel-2Tx-CodebookSubsetRestriction' (see 38.214 section 5.2.2.2.1)
+							twoTX-CodebookSubsetRestriction						BIT STRING (SIZE (6))
+						},
+						moreThanTwo											SEQUENCE {
+							-- Number of antenna ports in first (n1) and second (n2) dimension and codebook subset restriction
+							-- Corresponds to L1 parameters 'CodebookConfig-N1', 'CodebookConfig-N2'
+							-- 'TypeI-SinglePanel-CodebookSubsetRestriction ' (see 38.214 section 5.2.2.2.1)
+							n1-n2												CHOICE {
+								two-one-TypeI-SinglePanel-Restriction				BIT STRING (SIZE (8)),
+								two-two-TypeI-SinglePanel-Restriction				BIT STRING (SIZE (64)),
+								four-one-TypeI-SinglePanel-Restriction				BIT STRING (SIZE (16)),
+								three-two-TypeI-SinglePanel-Restriction				BIT STRING (SIZE (96)),
+								six-one-TypeI-SinglePanel-Restriction				BIT STRING (SIZE (24)),
+								four-two-TypeI-SinglePanel-Restriction				BIT STRING (SIZE (128)),
+								eight-one-TypeI-SinglePanel-Restriction				BIT STRING (SIZE (32)),
+								four-three-TypeI-SinglePanel-Restriction			BIT STRING (SIZE (192)),
+								six-two-TypeI-SinglePanel-Restriction				BIT STRING (SIZE (192)),
+								twelve-one-TypeI-SinglePanel-Restriction			BIT STRING (SIZE (48)),
+								four-four-TypeI-SinglePanel-Restriction				BIT STRING (SIZE (256)),
+								eight-two-TypeI-SinglePanel-Restriction				BIT STRING (SIZE (256)),
+								sixteen-one-TypeI-SinglePanel-Restriction			BIT STRING (SIZE (64))
+							},
+							-- i2 codebook subset restriction for Type I Single-panel codebook used when reportQuantity is CRI/Ri/i1/CQI
+							-- Corresponds to L1 parameter 'TypeI-SinglePanel-CodebookSubsetRestriction-i2' (see 38.214 section 5.2.2.2.1)
+							typeI-SinglePanel-codebookSubsetRestriction-i2		BIT STRING (SIZE (16))	OPTIONAL
+						}
+					},
+					-- Restriction for RI for TypeI-SinglePanel-RI-Restriction
+					-- Corresponds to L1 parameter 'TypeI-SinglePanel-RI-Restriction' (see 38.214, section 5.2.2.2.1)
+					typeI-SinglePanel-ri-Restriction					BIT STRING (SIZE (8))
+				}, 
+				typeI-MultiPanel									SEQUENCE {
+					-- Codebook subset restriction for Type I Multi-panel codebook
+					-- Corresponds to L1 parameter 'TypeI-MultiPanel-CodebookSubsetRestriction' (see 38.214, section 5.2.2.2.2)
+					ng-n1-n2												CHOICE {
+						two-two-one-TypeI-MultiPanel-Restriction				BIT STRING (SIZE (8)),
+						two-four-one-TypeI-MultiPanel-Restriction				BIT STRING (SIZE (32)),
+						four-two-one-TypeI-MultiPanel-Restriction				BIT STRING (SIZE (32)),
+						two-two-two-TypeI-MultiPanel-Restriction				BIT STRING (SIZE (128)),
+						two-eight-one-TypeI-MultiPanel-Restriction				BIT STRING (SIZE (64)),
+						four-four-one-TypeI-MultiPanel-Restriction				BIT STRING (SIZE (64)),
+						two-four-two-TypeI-MultiPanel-Restriction				BIT STRING (SIZE (256)),
+						four-two-two-TypeI-MultiPanel-Restriction				BIT STRING (SIZE (256))
+					},
+					-- Restriction for RI for TypeI-MultiPanel-RI-Restriction
+					-- Corresponds to L1 parameter 'TypeI-MultiPanel-RI-Restriction' (see 38.214, section 5.2.2.2.2)
+					ri-Restriction							BIT STRING (SIZE (4))
+				}
+			},
+			-- CodebookMode as specified in 38.214 section 5.2.2.2.2
+			codebookMode										INTEGER (1..2)
+
+		},
+		type2									SEQUENCE {
+			subType									CHOICE {
+				typeII									SEQUENCE {
+					-- Number of antenna ports in first (n1) and second (n2) dimension and codebook subset restriction
+					-- Corresponds to L1 parameters 'CodebookConfig-N1', 'CodebookConfig-N2'
+					-- The CHOICE name indicates the value of n1 and n2, the CHOICE contents is the codebook subset restriction bitmap
+					-- Corresponds to L1 parameter ' TypeII-CodebookSubsetRestriction' (see 38.214 section 5.2.2.2.3)
+					-- Number of bits for codebook subset restriction is ceil(log2(nchoosek(O1*O2,4)))+8*n1*n2 where nchoosek(a,b) = a!/(b!(a-b)!)
+					n1-n2-codebookSubsetRestriction			CHOICE {
+						two-one									BIT STRING (SIZE (16)),
+						two-two									BIT STRING (SIZE (139)),
+						four-one								BIT STRING (SIZE (32)),
+						three-two								BIT STRING (SIZE (59)),
+						six-one									BIT STRING (SIZE (49)),
+						four-two								BIT STRING (SIZE (75)),
+						eight-one								BIT STRING (SIZE (65)),
+						four-three								BIT STRING (SIZE (107)),
+						six-two									BIT STRING (SIZE (107)),
+						twelve-one								BIT STRING (SIZE (129)),
+						four-four								BIT STRING (SIZE (139)),
+						eight-two								BIT STRING (SIZE (139)),
+						sixteen-one								BIT STRING (SIZE (129))
+					},
+					-- Restriction for RI for TypeII-RI-Restriction
+					-- Corresponds to L1 parameter 'TypeII-RI-Restriction' (see 38.214, section 5.2.2.2.3)
+					typeII-RI-Restriction					BIT STRING (SIZE (2))
+				}, 
+				typeII-PortSelection					SEQUENCE {
+					-- The size of the port selection codebook (parameter d)
+					portSelectionSamplingSize				ENUMERATED {n1, n2, n3, n4}					OPTIONAL,		-- Cond TypeII-PortSelection
+					-- Restriction for RI for TypeII-PortSelection-RI-Restriction
+					-- Corresponds to L1 parameter 'TypeII-PortSelection-RI-Restriction' (see 38.214, section 5.2.2.4)
+					typeII-PortSelectionRI-Restriction		BIT STRING (SIZE (2))
+				}
+			},
+			-- The size of the PSK alphabet, QPSK or 8-PSK
+			phaseAlphabetSize						ENUMERATED {n4, n8},
+			-- If subband amplitude reporting is activated (true)
+			subbandAmplitude						BOOLEAN,
+			-- Number of beams, L,  used for linear combination
+			numberOfBeams							ENUMERATED {two, three, four}
+		}
+	}
+}
+
+-- TAG-CODEBOOKCONFIG-STOP
+-- TAG-CONFIGUREDGRANTCONFIG-START
+
+ConfiguredGrantConfig ::=				SEQUENCE {
+
+	-- Frequency hopping as agreed in RAN1-AH18776
+	frequencyHopping             ENUMERATED {mode1, mode2},
+	-- DMRS configuration, as agreed in RAN1-AH18776
+	cg-DMRS-Configuration		DMRS-UplinkConfig,
+
+	-- Indicates the MCS table the UE shall use for PUSCH without transform precoding, as agreed in RAN1-AH18776
+	mcs-Table					ENUMERATED {qam64, qam256},
+	-- Indicates the MCS table the UE shall use for PUSCH with transform precoding, as agreed in RAN1-AH18776
+	-- When the field is absent the UE applies the value 64QAM
+	mcs-TableTransformPrecoder		ENUMERATED {qam256}																	OPTIONAL,	-- Need S
+	-- Selection between and configuration of dynamic and semi-static beta-offset, as agreed in RAN1-AH18776
+	-- Note: For Type 1 UL data transmission without grant, "uci-on-PUSCH" should be set to semiStatic
+	uci-OnPUSCH							SetupRelease { CG-UCI-OnPUSCH },
+	-- Configuration of resource allocation type 0 and resource allocation type 1, as agreed in RAN1-AH18776
+	-- Note: For Type 1 UL data transmission without grant, "resourceAllocation" should be resourceAllocationType0 or resourceAllocationType1
+	resourceAllocation					ENUMERATED { resourceAllocationType0, resourceAllocationType1, dynamicSwitch },
+	-- Selection between config 1 and config 2 for RBG size for PUSCH. When the field is absent the UE applies the value config1.
+	-- Note: rbg-Size is used when the transformPrecoder parameter is disabled.
+	rbg-Size								ENUMERATED {config2}														OPTIONAL,	-- Need S
+									
+	-- Closed control loop to apply. Corresponds to L1 parameter 'PUSCH-closed-loop-index' (see 38.213, section FFS_Section)
+	powerControlLoopToUse					ENUMERATED {n0, n1},
+	-- Index of the P0-PUSCH-AlphaSet to be used for this configuration
+	p0-PUSCH-Alpha							P0-PUSCH-AlphaSetId,
+	-- Enable transformer precoder for type1 and type2. Absence indicates that it is disabled.
+	-- Corresponds to L1 parameter 'UL-TWG-tp' (see 38.214, section 6.1.3)
+	transformPrecoder						ENUMERATED {enabled}														OPTIONAL,	-- Need R
+	-- The number of HARQ processes configured. It applies for both Type 1 and Type 2
+	-- Corresponds to L1 parameter 'UL-TWG-numbHARQproc' (see 38.321, section 5.8.2)
+	nrofHARQ-Processes						INTEGER(1..16),
+	-- 	The number or repetitions of K:
+	repK									ENUMERATED {n1, n2, n4, n8},
+	-- If repetitions is used, this field indicates the redundancy version (RV) sequence to use.
+	-- Corresponds to L1 parameter 'UL-TWG-RV-rep' (see 38.321, section 5.8.2)
+	repK-RV									ENUMERATED {s1-0231, s2-0303, s3-0000}										OPTIONAL,	-- Cond RepK
+	-- Periodicity for UL transmission without UL grant for type 1 and type 2
+	-- Corresponds to L1 parameter 'UL-TWG-periodicity' (see 38.321, section 5.8.2)
+
+	-- The following periodicities are supported depending on the configured subcarrier spacing [symbols]:
+	--	15kHz: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 320, 640}
+	--	30kHz: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 640, 1280}
+	--	60kHz with normal CP: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1280, 2560}
+	--	60kHz with ECP: 2, 6, n*12, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1280, 2560}
+	--	120kHz: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1024, 1280, 2560, 5120}
+	-- (see 38.214, Table 6.1.2.3-1)
+	periodicity								ENUMERATED {
+												sym2, sym7, sym1x14, sym2x14, sym4x14, sym5x14, sym8x14, sym10x14, sym16x14, sym20x14,
+												sym32x14, sym40x14, sym64x14, sym80x14, sym128x14, sym160x14, sym256x14, sym320x14, sym512x14,
+												sym640x14, sym1024x14, sym1280x14, sym2560x14, sym5120x14,
+
+												sym6, sym1x12, sym2x12, sym4x12, sym5x12, sym8x12, sym10x12, sym16x12, sym20x12, sym32x12,
+												sym40x12, sym64x12, sym80x12, sym128x12, sym160x12, sym256x12, sym320x12, sym512x12, sym640x12,
+												sym1280x12, sym2560x12
+											},
+
+	-- If configured, the UE uses the configured grant timer (see 38.321, section 5.8.2) with this initial timer value.
+	-- Supported values are as follows in units of symbols:
+	-- For normal CP: 2, 7, {1, 2, 4, 5, 8, 10, 20, 32, 40, 64, 80, 128, 160, 256, 512, 640 } x 14
+	-- For extended CP: 2, 6, {1, 2, 4, 8, 20, 40, 80, 128, 160, 256, 320, 512, 640 } x 12
+	configuredGrantTimer					ENUMERATED {
+												sym2, sym7, sym1x14, sym2x14, sym4x14, sym5x14, sym8x14, sym10x14, sym16x14, sym20x14, sym32x14,
+												sym40x14, sym64x14, sym80x14, sym128x14, sym160x14, sym256x14, sym512x14, sym640x14,
+
+												sym6, sym1x12, sym2x12, sym4x12, sym5x12, sym8x12, sym10x12, sym16x12, sym20x12, sym32x12,
+												sym40x12, sym64x12, sym80x12, sym128x12, sym256x12, sym320x12, sym512x12, sym640x12
+											}																			OPTIONAL,	-- Need R
+	-- Selection between "configured grant" transmission with fully RRC-configured UL grant (Type1) 
+	-- or with UL grant configured by DCI addressed to CS-RNTI (Type2).
+	rrc-ConfiguredUplinkGrant		SEQUENCE {
+			-- Offset related to SFN=0
+			timeDomainOffset						INTEGER  (0..5119),
+			-- Corresponding to the DCI field of time domain resource assignment, and the maximum bit width is 4.
+			--(see 38.214, section 6.1.2 and 38.212, section 7.3.1)
+			timeDomainAllocation					 INTEGER  (0..15), -- RAN1 indicated just "Mapping-type,Index-start-len"
+            -- Corresponding to the DCI field of freq domain resource assignment. 
+			-- (see 38.214, section 6.1.2, and 38.212, section 7.3.1)
+			frequencyDomainAllocation				BIT STRING (SIZE(18)),
+			-- UE-specific DMRS configuration: corresponding to the DCI field of antenna ports, and the maximum bitwidth is 5. 
+			-- (see 38.214, section 6.1.2, and 38.212, section 7.3.1)
+            antennaPort								INTEGER   (0..31),
+            dmrs-SeqInitialization					INTEGER   (0..1)          					  OPTIONAL,  -- Cond NoTransformPrecoder
+            precodingAndNumberOfLayers				INTEGER   (0..63),
+            srs-ResourceIndicator					INTEGER   (0..15),
+			-- The modulation order, target code rate and TB size (see 38.214, section 6.1.2)
+			mcsAndTBS								INTEGER (0..31),
+			-- Enables intra-slot frequency hopping with the given frequency hopping offset
+			-- Corresponds to L1 parameter 'UL-TWG-hopping' (see 38.214, section FFS_Section)
+
+			frequencyHoppingOffset					INTEGER (1.. maxNrofPhysicalResourceBlocks-1),
+			pathlossReferenceIndex					INTEGER (0..maxNrofPUSCH-PathlossReferenceRSs-1),
+			...
+	}																								OPTIONAL  -- Cond Type1
+}
+
+CG-UCI-OnPUSCH ::= CHOICE {
+	dynamic									SEQUENCE (SIZE (1..4)) OF BetaOffsets,
+	semiStatic								BetaOffsets
+}
+
+-- TAG-CONFIGUREDGRANTCONFIG-STOP
+-- TAG-CONTROLRESOURCESET-START
+
+ControlResourceSet ::= 					SEQUENCE {
+	-- Corresponds to L1 parameter 'CORESET-ID'
+	-- Value 0 identifies the common CORESET configured in MIB and in ServingCellConfigCommon
+	-- Values 1..maxNrofControlResourceSets-1 identify CORESETs configured by dedicated signalling
+	-- The controlResourceSetId is unique among the BWPs of a ServingCell.
+	controlResourceSetId					ControlResourceSetId,
+
+
+	-- Frequency domain resources for the CORESET. Each bit corresponds a group of 6 RBs, with grouping starting from PRB 0, which is fully 
+	-- contained in the bandwidth part within which the CORESET is configured. 
+	-- The most significant bit corresponds to the group of lowest frequency which is fully contained in the bandwidth part within which the 
+	-- CORESET is configured, each next subsequent lower significance bit corresponds to the next lowest frequency group fully contained within
+	-- the bandwidth part within which the CORESET is configured, if any. 
+	-- Bits corresponding to a group not fully contained within the bandwidth part within which the CORESET is configured are set to zero. 
+	-- Corresponds to L1 parameter 'CORESET-freq-dom'(see 38.211, section 7.3.2.2)
+	frequencyDomainResources				BIT STRING (SIZE (45)),
+	-- Contiguous time duration of the CORESET in number of symbols 
+	-- Corresponds to L1 parameter 'CORESET-time-duration' (see 38.211, section 7.3.2.2FFS_Section)
+	duration								INTEGER (1..maxCoReSetDuration),
+	-- Mapping of Control Channel Elements (CCE) to Resource Element Groups (REG). 
+	-- Corresponds to L1 parameter 'CORESET-CCE-REG-mapping-type' (see 38.211Section sections 7.3.2.2 and 7.4.1.3.2)
+	cce-REG-MappingType							CHOICE { 
+		interleaved								SEQUENCE {
+			-- Resource Element Groups (REGs) can be bundled to create REG bundles. This parameter defines the size of such bundles. 
+			-- Corresponds to L1 parameter 'CORESET-REG-bundle-size' (see 38.211, section FFS_Section)
+			reg-BundleSize							ENUMERATED {n2, n3, n6},
+			-- Corresponds to L1 parameter 'CORESET-interleaver-size' (see 38.211, 38.213, section FFS_Section)
+			interleaverSize							ENUMERATED {n2, n3, n6}, 
+			-- Corresponds to L1 parameter 'CORESET-shift-index' (see 38.211, section 7.3.2.2)
+			shiftIndex								INTEGER(0..maxNrofPhysicalResourceBlocks-1)
+		}, 
+		nonInterleaved 							NULL
+	},
+	-- Precoder granularity in frequency domain. 
+	-- Corresponds to L1 parameter 'CORESET-precoder-granuality' (see 38.211, sections 7.3.2.2 and 7.4.1.3.2)
+	precoderGranularity						ENUMERATED {sameAsREG-bundle, allContiguousRBs},
+
+	-- A subset of the TCI states defined in TCI-States used for providing QCL relationships between the DL RS(s) in one RS Set 
+	-- (TCI-State) and the PDCCH DMRS ports. Corresponds to L1 parameter 'TCI-StatesPDCCH' (see 38.214, section FFS_Section)
+	tci-StatesPDCCH							SEQUENCE(SIZE (1..maxNrofTCI-StatesPDCCH)) OF TCI-StateId				OPTIONAL,	-- Need R
+
+	-- If at least spatial QCL is configured/indicated, this field indicates if TCI field is present or not present in DL-related DCI.
+	-- When the field is absent the UE considers the TCI to be absent/disabled.
+	-- Corresponds to L1 parameter 'TCI-PresentInDCI' (see 38,213, section 5.1.5)
+	tci-PresentInDCI						ENUMERATED {enabled}													OPTIONAL, 	-- Need S
+
+	-- PDCCH DMRS scrambling initalization. Corresponds to L1 parameter 'PDCCH-DMRS-Scrambling-ID' (see 38.214, section 5.1)
+	-- When the field is absent the UE applies the value '0'.
+	pdcch-DMRS-ScramblingID					BIT STRING (SIZE (16))													OPTIONAL 	-- Need S
+}
+
+-- TAG-CONTROLRESOURCESET-STOP
+-- TAG-CONTROL-RESOURCE-SET-ID-START
+
+ControlResourceSetId ::=				INTEGER (0..maxNrofControlResourceSets-1)
+
+-- TAG-CONTROL-RESOURCE-SET-ID-STOP
+
+CrossCarrierSchedulingConfig ::=		SEQUENCE {
+	schedulingCellInfo						CHOICE {
+		own										SEQUENCE {					-- No cross carrier scheduling
+			cif-Presence							BOOLEAN
+		},
+		other									SEQUENCE {					-- Cross carrier scheduling
+			schedulingCellId						ServCellIndex,
+			cif-InSchedulingCell					INTEGER (1..7)
+		}																	-- Cond SCellOnly
+	},
+	...
+}
+
+-- TAG-CSI-APERIODICTRIGGERSTATELIST-START
+
+CSI-AperiodicTriggerStateList ::=	SEQUENCE (SIZE (1..maxNrOfCSI-AperiodicTriggers)) OF CSI-AperiodicTriggerState 
+
+CSI-AperiodicTriggerState ::=		SEQUENCE {
+	associatedReportConfigInfoList		SEQUENCE (SIZE(1..maxNrofReportConfigPerAperiodicTrigger)) OF CSI-AssociatedReportConfigInfo,
+	...	
+}
+
+CSI-AssociatedReportConfigInfo ::=		SEQUENCE {
+	-- The reportConfigId of one of the CSI-ReportConfigToAddMod configured in CSI-MeasConfig
+	reportConfigId						CSI-ReportConfigId,
+
+	resourcesForChannel					CHOICE {
+       nzp-CSI-RS							SEQUENCE {
+			-- NZP-CSI-RS-ResourceSet for channel measurements. Entry number in nzp-CSI-RS-ResourceSetList in the CSI-ResourceConfig 
+			-- indicated by resourcesForChannelMeasurement in the CSI-ReportConfig indicated by reportConfigId above 
+			-- (1 corresponds to the first entry, 2 to thesecond entry, and so on).
+			resourceSet		INTEGER (1..maxNrofNZP-CSI-RS-ResourceSetsPerConfig),
+
+			-- List of references to TCI-States for providing the QCL source and QCL type for for each NZP-CSI-RS-Resource 
+			-- listed in nzp-CSI-RS-Resources of the NZP-CSI-RS-ResourceSet indicated by nzp-CSI-RS-ResourcesforChannel. 
+			-- First entry in qcl-info-forChannel corresponds to first entry in nzp-CSI-RS-Resources of that NZP-CSI-RS-ResourceSet, 
+			-- second entry in qcl-info-forChannel corresponds to second entry in nzp-CSI-RS-Resources,
+			-- and so on. Corresponds to L1 parameter 'QCL-Info-aPeriodicReportingTrigger' (see 38.214, section 5.2.1.5.1)
+			qcl-info						SEQUENCE (SIZE(1..maxNrofAP-CSI-RS-ResourcesPerSet)) OF TCI-StateId
+		},
+		-- CSI-SSB-ResourceSet for channel measurements. Entry number in csi-SSB-ResourceSetList in the CSI-ResourceConfig indicated by
+		-- resourcesForChannelMeasurement in the CSI-ReportConfig indicated by reportConfigId above (1 corresponds to the first entry, 2 to 
+		-- the second entry, and so on).
+		csi-SSB-ResourceSet					INTEGER (1..maxNrofCSI-SSB-ResourceSetsPerConfig)
+	},
+
+	-- CSI-IM-ResourceSet for interference measurement. Entry number in csi-IM-ResourceSetList in the CSI-ResourceConfig indicated by 
+	-- csi-IM-ResourcesForInterference in the CSI-ReportConfig indicated by reportConfigId above (1 corresponds to the first entry, 2 to the second
+	-- entry, and so on).
+	-- The indicated CSI-IM-ResourceSet should have exactly the same number of resources like the NZP-CSI-RS-ResourceSet indicated in 
+	-- nzp-CSI-RS-ResourcesforChannel.
+	-- This field can only be present if the CSI-ReportConfig identified by reportConfigId includes csi-IM-ResourcesForInterference.
+	csi-IM-ResourcesforInteference				INTEGER(1..maxNrofCSI-IM-ResourceSetsPerConfig)			OPTIONAL, --Cond CSI-IM-forInterference
+
+
+	-- NZP-CSI-RS-ResourceSet for interference measurement. Entry number in nzp-CSI-RS-ResourceSetList in the CSI-ResourceConfig indicated by 
+	-- nzp-CSI-RS-ResourcesForInterference in the CSI-ReportConfig indicated by reportConfigId above (1 corresponds to the first entry,
+	-- 2 to the second entry, and so on).
+	-- The indicated NZP-CSI-RS-ResourceSet should have exactly the same number of resources like the NZP-CSI-RS-ResourceSet indicated in 
+	-- nzp-CSI-RS-ResourcesforChannel.
+	-- This field can only be present if the CSI-ReportConfig identified by reportConfigId includes nzp-CSI-RS-ResourcesForInterference.
+	nzp-CSI-RS-ResourcesforInterference			INTEGER (1..maxNrofNZP-CSI-RS-ResourceSetsPerConfig)	OPTIONAL, --Cond LinkedNZP-CSI-RS-forInterference
+	...
+}
+
+-- TAG-CSI-APERIODICTRIGGERSTATELIST-STOP 
+-- TAG-CSI-FREQUENCYOCCUPATION-START
+
+CSI-FrequencyOccupation ::=				SEQUENCE {
+	-- PRB where this CSI resource starts in relation to PRB 0 of the associated BWP. 
+	-- Only multiples of 4 are allowed (0, 4, ...)
+	startingRB								INTEGER (0..maxNrofPhysicalResourceBlocks-1),
+	-- Number of PRBs across which this CSI resource spans. Only multiples of 4 are allowed. The smallest configurable 
+	-- number is the minimum of 24 and the width of the associated BWP.
+	nrofRBs									INTEGER (24..maxNrofPhysicalResourceBlocks),
+	...
+}
+
+-- TAG-CSI-FREQUENCYOCCUPATION-STOP
+-- TAG-CSI-IM-RESOURCE-START
+CSI-IM-Resource ::= 			SEQUENCE {
+	csi-IM-ResourceId						CSI-IM-ResourceId,
+
+	-- The resource element pattern (Pattern0 (2,2) or Pattern1 (4,1)) with corresponding parameters.
+	-- Corresponds to L1 parameter 'CSI-IM-RE-pattern' (see 38.214, section 5.2.2.3.4)
+	csi-IM-ResourceElementPattern				CHOICE {
+		pattern0									SEQUENCE {
+			-- OFDM subcarrier occupancy of the CSI-IM resource for Pattern0
+			-- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4)
+			subcarrierLocation-p0						ENUMERATED { s0, s2, s4, s6, s8, s10 },
+			-- OFDM symbol location of the CSI-IM resource for Pattern0 
+			-- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4)
+			symbolLocation-p0							INTEGER (0..12)
+		},
+		pattern1									SEQUENCE {
+			-- OFDM subcarrier occupancy of the CSI-IM resource for Pattern1
+			-- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4)
+			subcarrierLocation-p1						ENUMERATED { s0, s4, s8 },
+			-- OFDM symbol location of the CSI-IM resource for Pattern1 
+			-- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4)
+			symbolLocation-p1							INTEGER (0..13)
+		}
+	}																										OPTIONAL,	--Need M
+
+	-- Frequency-occupancy of CSI-IM. Corresponds to L1 parameter 'CSI-IM-FreqBand' (see 38.214, section 5.2.2.3.2)
+	freqBand									CSI-FrequencyOccupation										OPTIONAL,	-- Need M
+
+	-- Periodicity and slot offset for periodic/semi-persistent CSI-IM. Corresponds to L1 parameter 'CSI-IM-timeConfig' 
+	periodicityAndOffset					CSI-ResourcePeriodicityAndOffset								OPTIONAL, --Cond PeriodicOrSemiPersistent
+	...
+}
+
+-- TAG-CSI-IM-RESOURCE-STOP
+-- TAG-CSI-IM-RESOURCEID-START
+CSI-IM-ResourceId ::= 			INTEGER (0..maxNrofCSI-IM-Resources-1) 
+
+-- TAG-CSI-IM-RESOURCEID-STOP
+-- TAG-CSI-IM-RESOURCESET-START
+CSI-IM-ResourceSet ::=			SEQUENCE {
+
+	csi-IM-ResourceSetId					CSI-IM-ResourceSetId,
+	-- CSI-IM-Resources associated with this CSI-IM-ResourceSet
+	-- Corresponds to L1 parameter 'CSI-IM-ResourceConfigList' (see 38.214, section 5.2)
+	csi-IM-Resources						SEQUENCE (SIZE(1..maxNrofCSI-IM-ResourcesPerSet)) OF CSI-IM-ResourceId,
+	...
+}
+-- TAG-CSI-IM-RESOURCESET-STOP
+-- TAG-CSI-IM-RESOURCESETID-START
+
+CSI-IM-ResourceSetId ::=				INTEGER (0..maxNrofCSI-IM-ResourceSets-1)
+
+-- TAG-CSI-IM-RESOURCESETID-STOP
+-- TAG-CSI-MEAS-CONFIG-START
+
+CSI-MeasConfig ::=					SEQUENCE {
+	-- Pool of NZP-CSI-RS-Resource which can be referred to from NZP-CSI-RS-ResourceSet
+    nzp-CSI-RS-ResourceToAddModList		SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-Resources)) OF NZP-CSI-RS-Resource					OPTIONAL, -- Need N
+	nzp-CSI-RS-ResourceToReleaseList	SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-Resources)) OF NZP-CSI-RS-ResourceId				OPTIONAL, -- Need N
+
+	-- Pool of NZP-CSI-RS-ResourceSet which can be referred to from CSI-ResourceConfig or from MAC CEs
+	nzp-CSI-RS-ResourceSetToAddModList	SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourceSets)) OF NZP-CSI-RS-ResourceSet			OPTIONAL, -- Need N
+	nzp-CSI-RS-ResourceSetToReleaseList	SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourceSets)) OF NZP-CSI-RS-ResourceSetId			OPTIONAL, -- Need N
+
+	-- Pool of CSI-IM-Resource which can be referred to from CSI-IM-ResourceSet
+	csi-IM-ResourceToAddModList			SEQUENCE (SIZE (1..maxNrofCSI-IM-Resources)) OF CSI-IM-Resource							OPTIONAL, -- Need N
+	csi-IM-ResourceToReleaseList		SEQUENCE (SIZE (1..maxNrofCSI-IM-Resources)) OF CSI-IM-ResourceId						OPTIONAL, -- Need N
+
+	-- Pool of CSI-IM-ResourceSet which can be referred to from CSI-ResourceConfig or from MAC CEs
+	csi-IM-ResourceSetToAddModList		SEQUENCE (SIZE (1..maxNrofCSI-IM-ResourceSets)) OF CSI-IM-ResourceSet					OPTIONAL, -- Need N
+	csi-IM-ResourceSetToReleaseList		SEQUENCE (SIZE (1..maxNrofCSI-IM-ResourceSets)) OF CSI-IM-ResourceSetId					OPTIONAL, -- Need N
+
+	-- Pool of CSI-SSB-ResourceSet which can be referred to from CSI-ResourceConfig
+	csi-SSB-ResourceSetToAddModList		SEQUENCE (SIZE (1..maxNrofCSI-SSB-ResourceSets)) OF CSI-SSB-ResourceSet					OPTIONAL, -- Need N
+	csi-SSB-ResourceSetToAddReleaseList	SEQUENCE (SIZE (1..maxNrofCSI-SSB-ResourceSets)) OF CSI-SSB-ResourceSetId				OPTIONAL, -- Need N
+
+	-- Configured CSI resource settings as specified in TS 38.214 section 5.2.1.2
+	csi-ResourceConfigToAddModList 		SEQUENCE (SIZE (1..maxNrofCSI-ResourceConfigurations)) OF CSI-ResourceConfig			OPTIONAL, -- Need N
+	csi-ResourceConfigToReleaseList 	SEQUENCE (SIZE (1..maxNrofCSI-ResourceConfigurations)) OF CSI-ResourceConfigId			OPTIONAL, -- Need N
+
+	-- Configured CSI report settings as specified in TS 38.214 section 5.2.1.1
+	csi-ReportConfigToAddModList		SEQUENCE (SIZE (1..maxNrofCSI-ReportConfigurations)) OF CSI-ReportConfig				OPTIONAL, -- Need N
+	csi-ReportConfigToReleaseList		SEQUENCE (SIZE (1..maxNrofCSI-ReportConfigurations)) OF CSI-ReportConfigId				OPTIONAL, -- Need N
+	
+
+	-- Size of CSI request field in DCI (bits). Corresponds to L1 parameter 'ReportTriggerSize' (see 38.214, section 5.2)
+	reportTriggerSize				INTEGER (0..6)																				OPTIONAL,
+
+	-- Contains trigger states for dynamically selecting one or more aperiodic and semi-persistent reporting configurations
+	-- and/or triggering one or more aperiodic CSI-RS resource sets for channel and/or interference measurement.
+	-- FFS: How to address the MAC-CE configuration
+	aperiodicTriggerStateList			SetupRelease { CSI-AperiodicTriggerStateList }											OPTIONAL, -- Need M
+	semiPersistentOnPUSCH-TriggerStateList			SetupRelease { CSI-SemiPersistentOnPUSCH-TriggerStateList }					OPTIONAL, -- Need M
+	...
+}
+
+maxNrofNZP-CSI-RS-ResourceSets		INTEGER ::= 		64
+maxNrofNZP-CSI-RS-ResourceSets-1	INTEGER ::= 		63
+
+maxNrofCSI-SSB-ResourceSets 		INTEGER ::=			64
+maxNrofCSI-SSB-ResourceSets-1 		INTEGER ::=			63
+
+maxNrofCSI-IM-ResourceSets 			INTEGER ::=			64
+maxNrofCSI-IM-ResourceSets-1		INTEGER ::=			63
+
+-- TAG-CSI-MEAS-CONFIG-STOP 
+-- TAG-CSI-REPORTCONFIG-START
+-- Configuration of a CSI-Report sent on L1 (e.g. PUCCH) (see 38.214, section 5.2.1)
+CSI-ReportConfig ::=			SEQUENCE {
+	reportConfigId							CSI-ReportConfigId,
+
+	-- Indicates in which serving cell the CSI-ResourceConfigToAddMod(s) below are to be found.
+	-- If the field is absent, the resources are on the same serving cell as this report configuration.
+	carrier									ServCellIndex			OPTIONAL,	-- Need S
+
+	-- Resources for channel measurement. csi-ResourceConfigId of a CSI-ResourceConfig included in the configuration of the serving cell
+	-- indicated with the field "carrier" above. This CSI-ReportConfig is associated with the DL BWP indicated by bwp-Id in that CSI-ResourceConfig.
+	resourcesForChannelMeasurement			CSI-ResourceConfigId,
+
+	-- CSI IM resources for interference measurement. csi-ResourceConfigId of a CSI-ResourceConfig included in the configuration of the serving cell
+	-- indicated with the field "carrier" above. The bwp-Id in that CSI-ResourceConfigToAddMod is the same value like the bwp-Id in the
+	-- CSI-ResourceConfig indicated by resourcesForChannelMeasurement.
+	csi-IM-ResourcesForInterference			CSI-ResourceConfigId	OPTIONAL,	-- Need R
+
+	-- NZP CSI RS resources for interference measurement. csi-ResourceConfigId of a CSI-ResourceConfigToAddMod included in the configuration of the 
+	-- serving cell indicated with the field "carrier" above. The bwp-Id in that CSI-ResourceConfigToAddMod is the same value like the bwp-Id in the
+	-- CSI-ResourceConfigToAddMod indicated by resourcesForChannelMeasurement.
+	nzp-CSI-RS-ResourcesForInterference		CSI-ResourceConfigId	OPTIONAL, 	-- Need R
+
+	-- Time domain behavior of reporting configuration
+	reportConfigType						CHOICE {
+		periodic								SEQUENCE {
+			-- Periodicity and slot offset. Corresponds to L1 parameter 'ReportPeriodicity'and 'ReportSlotOffset' 
+			-- (see 38.214, section section 5.2.1.4).
+			reportSlotConfig						CSI-ReportPeriodicityAndOffset,
+			-- Indicates which PUCCH resource to use for reporting on PUCCH.
+			pucch-CSI-ResourceList					SEQUENCE (SIZE (1..maxNrofBWPs)) OF PUCCH-CSI-Resource
+		},
+		semiPersistentOnPUCCH					SEQUENCE {
+			-- Periodicity and slot offset. Corresponds to L1 parameter 'ReportPeriodicity' and 'ReportSlotOffset' 
+			-- (see 38.214, section section 5.2.1.4). 
+			reportSlotConfig						CSI-ReportPeriodicityAndOffset,
+			-- Indicates which PUCCH resource to use for reporting on PUCCH.
+			pucch-CSI-ResourceList					SEQUENCE (SIZE (1..maxNrofBWPs)) OF PUCCH-CSI-Resource
+		},
+		semiPersistentOnPUSCH					SEQUENCE {
+			-- Periodicity. Corresponds to L1 parameter 'Reportperiodicity-spCSI'. (see 38.214, section 5.2.1.1?FFS_Section)
+			reportSlotConfig						ENUMERATED {sl5, sl10, sl20, sl40, sl80, sl160, sl320},
+			-- Timing offset Y for aperiodic reporting using PUSCH. This field lists the allowed offset values. 
+			-- A particular value is indicated in DCI. The first report is transmitted in slot n+Y, second report in n+Y+P,
+			-- where P is the configured periodicity.
+			reportSlotOffsetList				SEQUENCE (SIZE (1..4)) OF INTEGER (0..7),
+			-- RNTI for SP CSI-RNTI, Corresponds to L1 parameter 'SPCSI-RNTI' (see 38.214, section 5.2.1.5.2)
+			-- FFS: RAN1 models different RNTIs as different Search Spaces with independent configurations. Align the configuration 
+			-- of this one (e.g. group with monitoring periodicity, PDCCH candidate configuration, DCI-Payload size...)?
+			csi-RNTI								RNTI-Value,
+			-- Index of the p0-alpha set determining the power control for this CSI report transmission. 
+			-- Corresponds to L1 parameter 'SPCSI-p0alpha' (see 38.214, section FFS_Section)
+			p0alpha									P0-PUSCH-AlphaSetId
+		},
+		aperiodic								SEQUENCE {
+			-- Timing offset Y for aperiodic reporting using PUSCH. This field lists the allowed offset values. A particular value is indicated in DCI. 
+			-- (see 38.214, section 5.2.3)
+			-- FFS_Value: Range wasn’t final in RAN1 table. 
+			-- FFS_FIXME: How are the DCI codepoints mapped to the allowed offsets?
+			reportSlotOffsetList				SEQUENCE (SIZE (1..16)) OF INTEGER (0..7)
+		}
+	},
+	-- The CSI related quanities to report. Corresponds to L1 parameter 'ReportQuantity' (see 38.214, section REF)
+	reportQuantity							CHOICE {
+		none									NULL,
+		cri-RI-PMI-CQI							NULL, 
+		cri-RI-i1								NULL, 
+		cri-RI-i1-CQI							SEQUENCE {
+			-- PRB bundling size to assume for CQI calcuation when reportQuantity is CRI/RI/i1/CQI
+			-- Corresponds to L1 parameter 'PDSCH-bundle-size-for-CSI' (see 38.214, section 5.2.1.4)
+			pdsch-BundleSizeForCSI					ENUMERATED {n2, n4}		OPTIONAL
+		}, 
+		cri-RI-CQI								NULL, 
+		cri-RSRP								NULL, 
+		ssb-Index-RSRP							NULL,
+		cri-RI-LI-PMI-CQI						NULL
+	},
+	-- Reporting configuration in the frequency domain. (see 38.214, section 5.2.1.4)
+	reportFreqConfiguration					 SEQUENCE {
+		-- Indicates whether the UE shall report a single (wideband) or multiple (subband) CQI. (see 38.214, section 5.2.1.4)
+		cqi-FormatIndicator						ENUMERATED { widebandCQI, subbandCQI },
+		-- Indicates whether the UE shall report a single (wideband) or multiple (subband) PMI. (see 38.214, section 5.2.1.4)
+		pmi-FormatIndicator						ENUMERATED { widebandPMI, subbandPMI },
+		-- Indicates a contiguous or non-contigous subset of subbands in the bandwidth part which CSI shall be reported 
+		-- for. Each bit in the bit-string represents one subband. The right-most bit in the bit string represents the 
+		-- lowest subband in the BWP. (see 38.214, section 5.2.1.4)
+		-- The number of subbands is determined according to 38.214 section 5.2.1.4. It is absent if there are less than 24 PRBs (no sub band)
+		-- and present otherwise, the number of sub bands can be from 3 (24 PRBs, sub band size 8) to 18 (72 PRBs, sub band size 4).
+		csi-ReportingBand						CHOICE {
+			subbands3								BIT STRING(SIZE(3)),
+			subbands4								BIT STRING(SIZE(4)),
+			subbands5								BIT STRING(SIZE(5)),
+			subbands6								BIT STRING(SIZE(6)),
+			subbands7								BIT STRING(SIZE(7)),
+			subbands8								BIT STRING(SIZE(8)),
+			subbands9								BIT STRING(SIZE(9)),
+			subbands10								BIT STRING(SIZE(10)),
+			subbands11								BIT STRING(SIZE(11)),
+			subbands12								BIT STRING(SIZE(12)),
+			subbands13								BIT STRING(SIZE(13)),
+			subbands14								BIT STRING(SIZE(14)),
+			subbands15								BIT STRING(SIZE(15)),
+			subbands16								BIT STRING(SIZE(16)),
+			subbands17								BIT STRING(SIZE(17)),
+			subbands18								BIT STRING(SIZE(18)),
+			...
+		}	OPTIONAL	-- Need S
+
+	},
+	-- Time domain measurement restriction for the channel (signal) measurements. 
+	-- Corresponds to L1 parameter 'MeasRestrictionConfig-time-channel' (see 38.214, section 5.2.1.1)
+	timeRestrictionForChannelMeasurements				ENUMERATED {configured, notConfigured},
+	-- Time domain measurement restriction for interference measurements. 
+	-- Corresponds to L1 parameter 'MeasRestrictionConfig-time-interference' (see 38.214, section 5.2.1.1)
+	timeRestrictionForInterferenceMeasurements			ENUMERATED {configured, notConfigured},
+	-- Codebook configuration for Type-1 or Type-II including codebook subset restriction
+	codebookConfig								CodebookConfig,
+	-- Maximum number of CQIs per CSI report (cf. 1 for 1-CW, 2 for 2-CW)	
+	nrofCQIsPerReport							ENUMERATED {n1, n2},
+	-- Turning on/off group beam based reporting (see 38.214, section 5.2.1.4)	
+	groupBasedBeamReporting						CHOICE {
+		enabled										NULL,
+		disabled 									SEQUENCE {
+			-- The number (N) of measured RS resources to be reported per report setting in a non-group-based report. 
+			-- N <= N_max, where N_max is either 2 or 4 depending on UE capability. 
+			-- FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. 
+			-- FFS: Note: this parameter may not be needed for certain resource and/or report settings
+			-- FFS_ASN1: Change groupBasedBeamReporting into a CHOICE and include this field into the "no" option?
+			-- (see 38.214, section FFS_Section)
+			-- When the field is absent the UE applies the value 1
+			nrofReportedRS							ENUMERATED {n1, n2, n3, n4}												OPTIONAL	-- Need S
+		}
+	},
+
+	-- Which CQI table to use for CQI calculation. Corresponds to L1 parameter 'CQI-table' (see 38.214, section 5.2.2.1)
+	cqi-Table								ENUMERATED {table1, table2, spare2, spare1}										OPTIONAL,
+	-- Indicates one out of two possible BWP-dependent values for the subband size as indicated in 38.214 table 5.2.1.4-2
+	-- Corresponds to L1 parameter 'SubbandSize' (see 38.214, section 5.2.1.4)
+	subbandSize								ENUMERATED {value1, value2},
+	-- BLER target that the UE shall be assume in its CQI calculation.
+	-- Corresponds to L1 parameter 'BLER-Target' (see 38.214, section 5.2.2.1)
+	-- FFS_Values (now filled with spares)
+	bler-Target								ENUMERATED {zerodot1, spare3, space2, spare1}										OPTIONAL,
+	-- Port indication for RI/CQI calculation. For each  CSI-RS resource in the linked ResourceConfig for channel measurement, 
+	-- a port indication for each rank R, indicating which R ports to use. Applicable only for non-PMI feedback.
+	-- Corresponds to L1 parameter 'Non-PMI-PortIndication' (see 38.214, section FFS_Section)
+	-- The first entry in non-PMI-PortIndication corresponds to the NZP-CSI-RS-Resource indicated by the first entry in
+	-- nzp-CSI-RS-Resources in the NZP-CSI-RS-ResourceSet indicated in the first entry of nzp-CSI-RS-ResourceSetList of the
+	-- CSI-ResourceConfig whose CSI-ResourceConfigId is indicated in a CSI-MeasId together with the above CSI-ReportConfigId,
+	-- the second entry in non-PMI-PortIndication corresponds to the NZP-CSI-RS-Resource indicated by the second entry in
+	-- nzp-CSI-RS-Resources in the NZP-CSI-RS-ResourceSet indicated in the first entry of nzp-CSI-RS-ResourceSetList of the
+	-- same CSI-ResourceConfig, and so on until the NZP-CSI-RS-Resource indicated by the last entry in nzp-CSI-RS-Resources
+	-- in the in the NZP-CSI-RS-ResourceSet indicated in the first entry of nzp-CSI-RS-ResourceSetList of the
+	-- same CSI-ResourceConfig, then the next entry corresponds to the NZP-CSI-RS-Resource indicated by the first entry
+	-- in nzp-CSI-RS-Resources in the NZP-CSI-RS-ResourceSet indicated in the second entry of nzp-CSI-RS-ResourceSetList of the
+	-- same CSI-ResourceConfig and so on.
+	non-PMI-PortIndication					SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourcesPerConfig)) OF PortIndexFor8Ranks		OPTIONAL,	...
+}
+
+CSI-ReportPeriodicityAndOffset ::= CHOICE {
+	slots4								INTEGER(0..3),
+	slots5								INTEGER(0..4),
+	slots8								INTEGER(0..7),
+	slots10								INTEGER(0..9),
+	slots16								INTEGER(0..15),
+	slots20								INTEGER(0..19),
+	slots40								INTEGER(0..39),
+	slots80								INTEGER(0..79),
+	slots160							INTEGER(0..159),
+	slots320							INTEGER(0..319)
+}
+
+PUCCH-CSI-Resource ::= 				CHOICE {
+	uplinkBandwidthPartId				BWP-Id,
+	-- PUCCH resource for the associated uplink BWP. Only PUCCH-Resource of format 2, 3 and 4 is supported.
+	pucch-Resource						PUCCH-Resource
+}
+
+-- The PortIndexFor8Ranks allows to indicate port indexes for 1 to 8 ranks using a port index ranges from 0 to 31, or from 0 to 15, or from 0
+-- to 7, or from 0 to 3, or from 0 to 1, or with 0 only.
+
+PortIndexFor8Ranks ::=	CHOICE {
+	portIndex8				SEQUENCE{
+		rank1-8					PortIndex8,
+		rank2-8					SEQUENCE(SIZE(1..2)) OF PortIndex8,
+		rank3-8					SEQUENCE(SIZE(1..3)) OF PortIndex8,
+		rank4-8					SEQUENCE(SIZE(1..4)) OF PortIndex8,
+		rank5-8					SEQUENCE(SIZE(1..5)) OF PortIndex8,
+		rank6-8					SEQUENCE(SIZE(1..6)) OF PortIndex8,
+		rank7-8					SEQUENCE(SIZE(1..7)) OF PortIndex8,
+		rank8-8					SEQUENCE(SIZE(1..8)) OF PortIndex8
+	},
+	portIndex4				SEQUENCE{
+		rank1-4					PortIndex4,
+		rank2-4					SEQUENCE(SIZE(1..2)) OF PortIndex4,
+		rank3-4					SEQUENCE(SIZE(1..3)) OF PortIndex4,
+		rank4-4					SEQUENCE(SIZE(1..4)) OF PortIndex4
+	},
+	portIndex2				SEQUENCE{
+		rank1-2					PortIndex2,
+		rank2-2					SEQUENCE(SIZE(1..2)) OF PortIndex2
+	},
+	portIndex1				NULL
+}
+
+PortIndex8::=	INTEGER (0..7)
+PortIndex4::=	INTEGER (0..3)
+PortIndex2::=	INTEGER (0..1)
+
+maxNrofNZP-CSI-RS-ResourcesPerConfig	INTEGER ::=	128
+-- TAG-CSI-REPORTCONFIG-STOP
+-- TAG-CSI-REPORTCONFIGID-START
+CSI-ReportConfigId ::= 					INTEGER (0..maxNrofCSI-ReportConfigurations-1)
+
+-- TAG-CSI-REPORTCONFIGID-STOP
+-- TAG-CSI-RESOURCECONFIG-START
+
+-- One CSI resource configuration comprising of one or more resource sets
+CSI-ResourceConfig ::= 		SEQUENCE {
+
+	-- Used in CSI-ReportConfig to refer to an instance of CSI-ResourceConfig
+	csi-ResourceConfigId				CSI-ResourceConfigId,
+
+	-- Contains up to maxNrofNZP-CSI-RS-ResourceSetsPerConfig resource sets if ResourceConfigType is 'aperiodic' and 1 otherwise.
+	-- Corresponds to L1 parameter 'ResourceSetConfigList' (see 38.214, section 5.2.1.3.1)	
+	csi-RS-ResourceSetList 	 			CHOICE {
+		nzp-CSI-RS-SSB 						SEQUENCE {
+			nzp-CSI-RS-ResourceSetList			SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourceSetsPerConfig)) OF NZP-CSI-RS-ResourceSetId OPTIONAL,
+			-- List of SSB resources used for beam measurement and reporting in a resource set
+			-- Corresponds to L1 parameter 'resource-config-SS-list' (see 38,214, section FFS_Section)
+			csi-SSB-ResourceSetList				SEQUENCE (SIZE (1..maxNrofCSI-SSB-ResourceSetsPerConfig)) OF CSI-SSB-ResourceSetId	OPTIONAL
+		},			
+		csi-IM-ResourceSetList				SEQUENCE (SIZE (1..maxNrofCSI-IM-ResourceSetsPerConfig)) OF CSI-IM-ResourceSetId
+	},
+
+
+	-- The DL BWP which the CSI-RS associated with this CSI-ResourceConfig are located in. 
+	-- Corresponds to L1 parameter 'BWP-Info' (see 38.214, section 5.2.1.2
+	bwp-Id								BWP-Id,
+
+	-- Time domain behavior of resource configuration. Corresponds to L1 parameter 'ResourceConfigType' (see 38.214, section 5.2.2.3.5)	
+	resourceType						ENUMERATED { aperiodic, semiPersistent, periodic },
+	...
+}
+
+-- TAG-CSI-RESOURCECONFIGTOADDMOD-STOP
+-- TAG-CSI-RESOURCECONFIGID-START
+CSI-ResourceConfigId ::= INTEGER (0..maxNrofCSI-ResourceConfigurations-1)
+
+-- TAG-CSI-RESOURCECONFIGID-STOP
+-- TAG-CSI-RESOURCEPERIODICITYANDOFFSET-START
+
+CSI-ResourcePeriodicityAndOffset ::=	CHOICE {
+	slots4							INTEGER (0..3), 
+	slots5							INTEGER (0..4), 
+	slots8							INTEGER (0..7), 
+	slots10							INTEGER (0..9), 
+	slots16							INTEGER (0..15), 
+	slots20							INTEGER (0..19), 
+	slots32							INTEGER (0..31), 
+	slots40							INTEGER (0..39), 
+	slots64							INTEGER (0..63), 
+	slots80							INTEGER (0..79), 
+	slots160						INTEGER (0..159), 
+	slots320						INTEGER (0..319), 
+	slots640						INTEGER (0..639)
+}
+
+-- TAG-CSI-RESIYRCEPERIODICITYANDOFFSET-STOP
+-- TAG-CSI-RS-RESOURCEMAPPING-START
+
+CSI-RS-ResourceMapping ::= 				SEQUENCE {
+	-- Frequency domain allocation within a physical resource block in accordance with 38.211, section 7.4.1.5.3 including table 7.4.1.5.2-1.
+	-- The number of bits that may be set to one depend on the chosen row in that table. For the choice "other", the row can be determined from
+	-- the parmeters below and from the number of bits set to 1 in frequencyDomainAllocation.
+	frequencyDomainAllocation			CHOICE {
+		row1								BIT STRING (SIZE (4)),
+		row2								BIT STRING (SIZE (12)),
+		row4								BIT STRING (SIZE (3)),
+		other								BIT STRING (SIZE (6))
+	},
+	-- Number of ports (see 38.214, section 5.2.2.3.1)
+	nrofPorts							ENUMERATED {p1,p2,p4,p8,p12,p16,p24,p32},
+	-- Time domain allocation within a physical resource block. The field indicates the first OFDM symbol in the PRB used for CSI-RS.
+	-- Parameter l0 in 38.211, section 7.4.1.5.3. Value 2 is supported only when DL-DMRS-typeA-pos equals 3.
+	firstOFDMSymbolInTimeDomain			INTEGER (0..13),
+	-- Time domain allocation within a physical resource block. Parameter l1 in 38.211, section 7.4.1.5.3.
+	firstOFDMSymbolInTimeDomain2		INTEGER (0..13)																OPTIONAL,	-- Need R
+	-- CDM type (see 38.214, section 5.2.2.3.1)	
+	cdm-Type								ENUMERATED {noCDM, fd-CDM2, cdm4-FD2-TD2, cdm8-FD2-TD4},
+	-- Density of CSI-RS resource measured in RE/port/PRB. Corresponds to L1 parameter 'CSI-RS-Density'  (see 38.211, section 7.4.1.5.3)
+	-- Values 0.5 (dot5), 1 (one) and 3 (three) are allowed for X=1,
+	-- values 0.5 (dot5) and 1 (one) are allowed for X=2, 16, 24 and 32,
+	-- value 1 (one) is allowed for X=4, 8, 12.
+	-- For density = 1/2, includes 1 bit indication for RB level comb offset indicating  whether odd or even RBs are occupied by CSI-RS
+	density									CHOICE {
+		dot5									ENUMERATED {evenPRBs, oddPRBs}, 
+		one										NULL, 
+		three									NULL, 
+		spare									NULL
+	},
+	-- Wideband or partial band CSI-RS. Corresponds to L1 parameter 'CSI-RS-FreqBand' (see 38.214, section 5.2.2.3.1)	
+	freqBand								CSI-FrequencyOccupation,
+	...
+}
+
+-- TAG-CSI-RS-RESOURCEMAPPING-STOP
+-- TAG-CSI-SEMIPERSISTENTONPUSCHTRIGGERSTATELIST-START
+
+CSI-SemiPersistentOnPUSCH-TriggerStateList ::=	SEQUENCE(SIZE (1..maxNrOfSemiPersistentPUSCH-Triggers)) OF CSI-SemiPersistentOnPUSCH-TriggerState
+CSI-SemiPersistentOnPUSCH-TriggerState ::=		SEQUENCE {
+	associatedReportConfigInfo						CSI-ReportConfigId,
+	...
+}
+
+maxNrOfSemiPersistentPUSCH-Triggers					INTEGER ::= 64		-- Maximum number of triggers for semi persistent reporting on PUSCH
+
+-- TAG-CSI-SEMIPERSISTENTONPUSCHTRIGGERSTATELIST-STOP 
+-- TAG-CSI-SSB-RESOURCESETID-START
+
+CSI-SSB-ResourceSetId ::=	INTEGER (0..maxNrofCSI-SSB-ResourceSets-1)
+
+-- TAG-CSI-SSB-RESOURCESETID-STOP
+-- TAG-CSI-SSB-RESOURCESET-START
+
+CSI-SSB-ResourceSet ::=						SEQUENCE {
+	csi-SSB-ResourceSetId						CSI-SSB-ResourceSetId,
+	csi-SSB-ResourceList						SEQUENCE (SIZE(1..maxNrofCSI-SSB-ResourcePerSet)) OF SSB-Index,
+	...
+}
+
+-- TAG-CSI-SSB-RESOURCESET-STOP
+-- TAG-DMRS-DOWNLINKCONFIG-START
+
+DMRS-DownlinkConfig ::=					SEQUENCE {
+	-- Selection of the DMRS type to be used for DL (see 38.211, section 7.4.1.1.1).
+	-- If the field is absent, the UE uses DMRS type 1.
+	dmrs-Type								ENUMERATED {type2}													OPTIONAL,	-- Need R
+	-- Position for additional DM-RS in DL, see Table 7.4.1.1.2-4 in 38.211. 
+	-- The four values represent the cases of 1+0, 1+1, 1+1+1. 1+1+1+1 non-adjacent OFDM symbols for DL.
+	-- If the field is absent, the UE applies the value pos2.
+	dmrs-AdditionalPosition					ENUMERATED {pos0, pos1, pos3}										OPTIONAL,	-- Need R
+	-- DM-RS groups that are QCL:ed, i.e. group 1 (see 38.214, section 5.1)
+	dmrs-group1								BIT STRING (SIZE (12))												OPTIONAL,	-- Need R
+	-- DM-RS groups that are QCL:ed, i.e. group 2 (see 38.214, section 5.1)
+	dmrs-group2								BIT STRING (SIZE (12))												OPTIONAL,	-- Need R
+	-- The maximum number of OFDM symbols for DL front loaded DMRS. 'len1' corresponds to value 1. 'len2 corresponds to value 2.
+	-- If the field is absent, the UE applies value len1.
+	-- Corresponds to L1 parameter 'DL-DMRS-max-len' (see 38.214, section 5.1)
+	maxLength								ENUMERATED {len2}													OPTIONAL, 	-- Need R
+	-- DL DMRS scrambling initalization
+	-- Corresponds to L1 parameter 'n_SCID 0' (see 38.211, section 7.4.1)
+	-- When the field is absent the UE applies the value Physical cell ID (physCellId) configured for this serving cell."
+	scramblingID0							INTEGER (0..65535)													OPTIONAL, 	-- Need S
+	-- DL DMRS scrambling initalization. Corresponds to L1 parameter 'n_SCID 1' (see 38.211, section 7.4.1)
+	-- When the field is absent the UE applies the value (physCellId) configured for this serving cell.
+	scramblingID1							INTEGER (0..65535)													OPTIONAL, 	-- Need S
+
+	-- Configures downlink PTRS. If absent of released, the UE assumes that downlink PTRS are not present. See 38.214 section 5.1.6.3
+	phaseTrackingRS						SetupRelease { PTRS-DownlinkConfig	}									OPTIONAL,	-- Need M
+
+	...
+}
+
+-- TAG-DMRS-DOWNLINKCONFIG-STOP
+-- TAG-DMRS-UPLINKCONFIG-START
+
+DMRS-UplinkConfig ::=					SEQUENCE {
+	-- Selection of the DMRS type to be used for UL (see section 38.211, section 6.4.1.1.3)
+	-- If the field is absent, the UE uses DMRS type 1.
+	dmrs-Type								ENUMERATED {type2} 													OPTIONAL,	-- Need R
+	-- Position for additional DM-RS in UL. Corresponds to L1 parameter 'UL-DMRS-add-pos' (see Table 7.4.1.1.2-4 in 38.211) 
+	-- The four values represent the cases of 1+0, 1+1, 1+1+1. 1+1+1+1 non-adjacent OFDM symbols for UL. 
+	-- If the field is absent, the UE applies the value pos2.
+	dmrs-AdditionalPosition					ENUMERATED {pos0, pos1, pos3}										OPTIONAL,	-- Need R
+	-- Configures uplink PTRS (see 38.211, section x.x.x.x) FFS_Ref
+	phaseTrackingRS						SetupRelease { PTRS-UplinkConfig }										OPTIONAL,	-- Need M
+	-- The maximum number of OFDM symbols for UL front loaded DMRS. 'len1' corresponds to value 1. 'len2 corresponds to value 2.
+	-- If the field is absent, the UE applies value len1.
+	-- Corresponds to L1 parameter 'UL-DMRS-max-len' (see 38.214, section 6.4.1.1.2)
+	maxLength								ENUMERATED {len2}													OPTIONAL, 	-- Need R
+
+	transformPrecoding					CHOICE {
+		-- DMRS related parameters for Cyclic Prefix OFDM
+		disabled									SEQUENCE {
+			-- UL DMRS scrambling initalization for CP-OFDM
+			-- Corresponds to L1 parameter 'n_SCID 0' (see 38.214, section 6.4.1.1.2)
+			-- When the field is absent the UE applies the value Physical cell ID (physCellId)
+			scramblingID0							INTEGER (0..65535)											OPTIONAL,	-- Need S
+			-- UL DMRS scrambling initalization for CP-OFDM.
+			-- Corresponds to L1 parameter 'n_SCID 1' (see 38.214, section 6.4.1.1.2)
+			-- When the field is absent the UE applies the value Physical cell ID (physCellId)
+			scramblingID1							INTEGER (0..65535)											OPTIONAL		-- Need S
+
+		},
+		-- DMRS related parameters for DFT-s-OFDM (Transform Precoding)
+		enabled								SEQUENCE {
+			-- Parameter: N_ID^(PUSCH) for DFT-s-OFDM DMRS. If the value is absent or released, the UE uses the Physical cell ID.
+			-- Corresponds to L1 parameter 'nPUSCH-Identity-Transform precoding' (see 38.211, section FFS_Section)
+			nPUSCH-Identity							INTEGER(0..1007)											OPTIONAL,	-- Need S
+			-- Sequence-group hopping for PUSCH can be disabled for a certain UE despite being enabled on a cell basis. For DFT-s-OFDM DMRS
+			-- If the field is released, the UE considers group hopping to be enabled.
+			-- Corresponds to L1 parameter 'Disable-sequence-group-hopping-Transform-precoding' (see 38.211, section FFS_Section)
+			disableSequenceGroupHopping				ENUMERATED {disabled}										OPTIONAL,	-- Need S
+			-- Determines if sequence hopping is enabled or not. For DFT-s-OFDM DMRS. 
+			-- If the field is released, the UE considers sequence hopping to be disabled.
+			-- Corresponds to L1 parameter 'Sequence-hopping-enabled-Transform-precoding' (see 38.211, section FFS_Section)
+			sequenceHoppingEnabled					ENUMERATED {enabled}										OPTIONAL	-- Need S
+		}
+	},
+	...
+}
+
+-- TAG-DMRS-UPLINKCONFIG-STOP
+-- TAG-DOWNLINKPREEMPTION-START
+
+-- Configuration of downlink preemption indication on PDCCH.
+DownlinkPreemption ::=						SEQUENCE {
+	-- RNTI used for indication pre-emption in DL. 
+	-- Corresponds to L1 parameter 'INT-RNTI', where ”INT” stands for ”interruption” (see 38.213, section 10)
+	int-RNTI								RNTI-Value,
+
+	-- Set selection for DL-preemption indication. Corresponds to L1 parameter 'int-TF-unit' (see 38.213, section 10.1)
+	-- The set determines how the UE interprets the DL preemption DCI payload.
+	timeFrequencySet						ENUMERATED {set0, set1},
+
+	-- Total length of the DCI payload scrambled with INT-RNTI. The value must be an integer multiple of 14 bit.
+	-- Corresponds to L1 parameter 'INT-DCI-payload-length' (see 38.213, section 11.2)
+	dci-PayloadSize							INTEGER (0..maxINT-DCI-PayloadSize),
+
+	-- Indicates (per serving cell) the position of the 14 bit INT values inside the DCI payload. 
+	-- Corresponds to L1 parameter 'INT-cell-to-INT' and 'cell-to-INT' (see 38.213, section 11.2)
+	int-ConfigurationPerServingCell			SEQUENCE (SIZE (1..maxNrofServingCells)) OF INT-ConfigurationPerServingCell,
+	...
+}
+
+INT-ConfigurationPerServingCell ::= 		SEQUENCE {
+	servingCellId							ServCellIndex,
+	-- Starting position (in number of bit) of the 14 bit INT value applicable for this serving cell (servingCellId) within the DCI 
+	-- payload. Must be multiples of 14 (bit). Corresponds to L1 parameter 'INT-values' (see 38.213, section 11.2)
+	positionInDCI							INTEGER (0..maxINT-DCI-PayloadSize-1)
+}
+
+-- TAG-DOWNLINKPREEMPTION-STOP
+-- TAG-DRB-IDENTITY-START
+
+DRB-Identity ::=					INTEGER (1..32)
+
+-- TAG-DRB-IDENTITY-STOP
+-- TAG-EUTRA-MBSFN-SUBFRAMECONFIGLIST-START
+
+EUTRA-MBSFN-SubframeConfigList ::= 		SEQUENCE (SIZE (1..maxMBSFN-Allocations)) OF EUTRA-MBSFN-SubframeConfig
+
+EUTRA-MBSFN-SubframeConfig ::=			SEQUENCE {
+	-- Field as defined in MBSFN-SubframeConfig in 36.331 
+	radioframeAllocationPeriod			ENUMERATED {n1, n2, n4, n8, n16, n32},
+	-- Field as defined in MBSFN-SubframeConfig in 36.331 
+	radioframeAllocationOffset			INTEGER (0..7),
+	-- Field as defined in MBSFN-SubframeConfig in 36.331 
+	subframeAllocation					CHOICE {
+		-- Field as defined in MBSFN-SubframeConfig in 36.331 
+		oneFrame							BIT STRING (SIZE(6)),
+		-- Field as defined in MBSFN-SubframeConfig in 36.331 
+		fourFrames							BIT STRING (SIZE(24))
+	},
+	subframeAllocation-v1430			CHOICE {
+		-- Field as defined in MBSFN-SubframeConfig in 36.331 
+		oneFrame-v1430						BIT STRING (SIZE(2)),
+		-- Field as defined in MBSFN-SubframeConfig in 36.331 
+		fourFrames-v1430					BIT STRING (SIZE(8))
+	}																														OPTIONAL,	-- Need R
+	...
+}
+
+-- TAG-EUTRA-MBSFN-SUBFRAMECONFIGLIST-STOP
+
+FilterCoefficient ::=					ENUMERATED {
+											fc0, fc1, fc2, fc3, fc4, fc5,
+											fc6, fc7, fc8, fc9, fc11, fc13, 
+											fc15, fc17, fc19, spare1, ...}
+
+-- TAG-FREQBANDINDICATORNR-START
+
+FreqBandIndicatorNR ::=     		INTEGER (1..1024)
+
+-- TAG-FREQBANDINDICATORNR-STOP
+-- TAG-FREQUENCY-INFO-DL-START
+
+FrequencyInfoDL ::= 				SEQUENCE {
+	-- Frequency of the SSB to be used for this serving cell. The frequency provided in this field identifies the position of 
+	-- resource element RE=#0 (subcarrier #0) of resource block RB#10 of the SS block. The cell-defining SSB of an SpCell is always on
+	-- the sync raster. Frequencies are considered to be on the sync raster if they are also identifiable with a GSCN value (see 38.101).
+	absoluteFrequencySSB					ARFCN-ValueNR,
+	-- The frequency domain offset between SSB and the overall resource block grid in number of subcarriers. 
+	-- Absence of the field indicates that no offset is applied (offset = 0). For FR2 only values up to 11 are applicable. 
+	-- Corresponds to L1 parameter kssb (See 38.211, section 7.4.3.1)
+	ssb-SubcarrierOffset					INTEGER (1..23)																OPTIONAL,	-- Need S
+	-- List of one or multiple frequency bands to which this carrier(s) belongs. Multiple values are only supported in 
+	-- system information but not when the FrequencyInfoDL is provided in dedicated signalling (HO or S(p)Cell addition).
+	frequencyBandList					MultiFrequencyBandListNR,
+	-- Absolute frequency position of the reference resource block (Common RB 0). Its lowest subcarrier is also known as Point A. 
+	-- Note that the lower edge of the actual carrier is not defined by this field but rather in the scs-SpecificCarrierList.
+	-- Corresponds to L1 parameter 'offset-ref-low-scs-ref-PRB' (see 38.211, section FFS_Section)
+	absoluteFrequencyPointA					ARFCN-ValueNR,
+
+	-- A set of carriers for different subcarrier spacings (numerologies). Defined in relation to Point A.
+	-- Corresponds to L1 parameter 'offset-pointA-set' (see 38.211, section FFS_Section)
+	scs-SpecificCarrierList					SEQUENCE (SIZE (1..maxSCSs)) OF SCS-SpecificCarrier,
+	...
+}
+
+-- TAG-FREQUENCY-INFO-UL-STOP
+-- TAG-FREQUENCY-INFO-UL-START
+
+FrequencyInfoUL ::= 				SEQUENCE {
+	-- List of one or multiple frequency bands to which this carrier(s) belongs. Multiple values are only supported in 
+	-- system information but not when the FrequencyInfoDL is provided in dedicated signalling (HO or S(p)Cell addition).
+	frequencyBandList					MultiFrequencyBandListNR										OPTIONAL,	-- Cond FDD-OrSUL
+	-- Absolute frequency of the reference resource block (Common RB 0). Its lowest subcarrier is also known as Point A.
+	-- Corresponds to L1 parameter 'offset-ref-low-scs-ref-PRB' (see 38.211, section FFS_Section)
+	absoluteFrequencyPointA						ARFCN-ValueNR					OPTIONAL,	-- Cond FDD-OrSUL
+	-- A set of virtual carriers for different subcarrier spacings (numerologies). Defined in relation to Point A.
+	-- Note that the lower edge of the actual carrier is not defined by this field but rather in the scs-SpecificCarrierList.
+	-- Corresponds to L1 parameter 'offset-pointA-set' (see 38.211, section FFS_Section)
+	scs-SpecificCarriers				SEQUENCE (SIZE (1..maxSCSs)) OF SCS-SpecificCarrier,
+
+	-- The additional spectrum emission requirements to be applied by the UE on this uplink. 
+	-- If the field is absent, the UE applies the value FFS_RAN4. (see FFS_section, section FFS_Section)
+	additionalSpectrumEmission			AdditionalSpectrumEmission										OPTIONAL,	-- Need S
+	-- FFS_Definition. Corresponds to parameter FFS_RAN4. (see FFS_Spec, section FFS_Section)
+	-- If the field is absent, the UE applies the value FFS_RAN4.
+	p-Max								P-Max															OPTIONAL,	-- Need S
+	-- Enable the NR UL transmission with a 7.5KHz shift to the LTE raster. If the field is absent, the frequency shift is disabled.
+	frequencyShift7p5khz				ENUMERATED {true}												OPTIONAL,	-- Cond FDD-OrSUL-Optional
+	...
+}
+
+-- TAG-FREQUENCY-INFO-UL-STOP
+-- TAG-GSCN-VALUE-NR-START
+
+GSCN-ValueNR ::=				INTEGER (1..28557)
+
+
+-- TAG-GSCN-VALUE-NR-STOP
+
+Hysteresis ::=							INTEGER (0..30)
+
+-- TAG-LOGICAL-CHANNEL-CONFIG-START
+
+LogicalChannelConfig ::=		SEQUENCE {
+	ul-SpecificParameters			SEQUENCE {
+		priority						INTEGER (1..16),
+		prioritisedBitRate				ENUMERATED {kBps0, kBps8, kBps16, kBps32, kBps64, kBps128, kBps256, kBps512, 
+											kBps1024, kBps2048, kBps4096, kBps8192, kBps16384, kBps32768, kBps65536, infinity},
+		bucketSizeDuration				ENUMERATED {ms50, ms100, ms150, ms300, ms500, ms1000, spare2, spare1},
+
+		allowedServingCells				SEQUENCE (SIZE (1..maxNrofServingCells-1)) OF ServCellIndex					OPTIONAL,	-- Need R
+		allowedSCS-List					SEQUENCE (SIZE (1..maxSCSs)) OF SubcarrierSpacing							OPTIONAL,	-- Need R
+		maxPUSCH-Duration				ENUMERATED { ms0p02, ms0p04, ms0p0625, ms0p125, ms0p25, ms0p5, spare2, spare1 }												OPTIONAL,	-- Need R
+		configuredGrantType1Allowed		ENUMERATED {true}															OPTIONAL,	-- Need R
+
+		logicalChannelGroup				INTEGER (0..maxLCG-ID)														OPTIONAL, 	-- Need R
+		schedulingRequestID				SchedulingRequestId															OPTIONAL,	-- Need R
+		logicalChannelSR-Mask			BOOLEAN,
+		logicalChannelSR-DelayTimerApplied	BOOLEAN
+	}																												OPTIONAL,		-- Cond UL
+
+	-- other parameters
+	...
+}
+
+-- TAG-LOGICAL-CHANNEL-CONFIG-STOP
+-- TAG-MAC-CELL-GROUP-CONFIG-START
+
+MAC-CellGroupConfig ::= 			SEQUENCE {
+	drx-Config							SetupRelease { DRX-Config }																OPTIONAL, -- Need M
+
+	schedulingRequestConfig				SchedulingRequestConfig																OPTIONAL, -- Need M
+	bsr-Config							BSR-Config																	OPTIONAL,	-- Need M
+	tag-Config							TAG-Config																	OPTIONAL,	-- Need M	
+	phr-Config							SetupRelease { PHR-Config }																OPTIONAL,	-- Need M
+	-- FFS : configurable per SCell?
+	skipUplinkTxDynamic					BOOLEAN,
+	-- RNTI value for downlink SPS (see SPS-config) and uplink configured scheduling (see ConfiguredSchedulingConfig).
+	cs-RNTI								SetupRelease { RNTI-Value }															OPTIONAL	-- Need M
+}
+
+DRX-Config ::=						SEQUENCE {
+	drx-onDurationTimer					CHOICE {
+											subMilliSeconds	INTEGER (1..31),
+											milliSeconds	ENUMERATED {
+											ms1, ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30, ms40, ms50, ms60, 
+											ms80, ms100, ms200, ms300, ms400, ms500, ms600, ms800, ms1000, ms1200, 
+											ms1600, spare9, spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 }
+											},
+	drx-InactivityTimer					ENUMERATED { 
+											ms0, ms1, ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30, ms40, ms50, ms60, ms80, 
+											ms100, ms200, ms300, ms500, ms750, ms1280, ms1920, ms2560, spare9, spare8, 
+											spare7, spare6, spare5, spare4, spare3, spare2, spare1},
+	drx-HARQ-RTT-TimerDL				INTEGER (0..56),
+	drx-HARQ-RTT-TimerUL				INTEGER (0..56),
+	drx-RetransmissionTimerDL			ENUMERATED { 
+											sl0, sl1, sl2, sl4, sl6, sl8, sl16, sl24, sl33, sl40, sl64, sl80, sl96, sl112, sl128, 
+											sl160, sl320, spare15, spare14, spare13, spare12, spare11, spare10, spare9, 
+											spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1},
+	drx-RetransmissionTimerUL			ENUMERATED {
+											sl0, sl1, sl2, sl4, sl6, sl8, sl16, sl24, sl33, sl40, sl64, sl80, sl96, sl112, sl128, 
+											sl160, sl320, spare15, spare14, spare13, spare12, spare11, spare10, spare9, 
+											spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 },
+	drx-LongCycleStartOffset		CHOICE {
+		ms10							INTEGER(0..9),
+		ms20							INTEGER(0..19),
+		ms32							INTEGER(0..31),
+		ms40							INTEGER(0..39),
+		ms60							INTEGER(0..59),
+		ms64							INTEGER(0..63),
+		ms70							INTEGER(0..69),
+		ms80							INTEGER(0..79),
+		ms128							INTEGER(0..127),
+		ms160							INTEGER(0..159),
+		ms256							INTEGER(0..255),
+		ms320							INTEGER(0..319),
+		ms512							INTEGER(0..511),
+		ms640							INTEGER(0..639),
+		ms1024							INTEGER(0..1023),
+		ms1280							INTEGER(0..1279),
+		ms2048							INTEGER(0..2047),
+		ms2560							INTEGER(0..2559),
+		ms5120							INTEGER(0..5119),
+		ms10240							INTEGER(0..10239)
+	},
+	-- FFS need for finer offset granulary
+	-- FFS need for shorter values for long and short cycles
+	shortDRX							SEQUENCE {
+		drx-ShortCycle						ENUMERATED	{
+												ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32,
+												ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, spare9,
+												spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 },
+		drx-ShortCycleTimer					INTEGER (1..16)
+	}		OPTIONAL,													-- Need R
+	drx-SlotOffset						INTEGER (0..31)
+
+}
+
+PHR-Config ::=						SEQUENCE {
+	phr-PeriodicTimer					ENUMERATED {sf10, sf20, sf50, sf100, sf200,sf500, sf1000, infinity},
+	phr-ProhibitTimer					ENUMERATED {sf0, sf10, sf20, sf50, sf100,sf200, sf500, sf1000},
+	phr-Tx-PowerFactorChange			ENUMERATED {dB1, dB3, dB6, infinity},
+	multiplePHR							BOOLEAN,
+	phr-Type2PCell						BOOLEAN,
+	phr-Type2OtherCell					BOOLEAN,
+	phr-ModeOtherCG						ENUMERATED {real, virtual}
+
+}
+
+
+TAG-Config ::=				SEQUENCE {
+	tag-ToReleaseList			SEQUENCE (SIZE (1..maxNrofTAGs)) OF TAG-Id											OPTIONAL,	-- Need N
+	tag-ToAddModList			SEQUENCE (SIZE (1..maxNrofTAGs)) OF TAG-ToAddMod											OPTIONAL		-- Need N
+}
+
+TAG-ToAddMod ::= 			SEQUENCE {
+	tag-Id						TAG-Id,
+	timeAlignmentTimer			TimeAlignmentTimer,
+	...
+}
+
+TAG-Id ::=					INTEGER (0..maxNrofTAGs-1)
+
+TimeAlignmentTimer ::= 		ENUMERATED {ms500, ms750, ms1280, ms1920, ms2560, ms5120, ms10240, infinity}
+
+BSR-Config ::=				SEQUENCE {
+	periodicBSR-Timer			ENUMERATED {
+									sf1, sf5, sf10, sf16, sf20, sf32, sf40, sf64, sf80, sf128, sf160, sf320, sf640, sf1280, sf2560, infinity},
+	retxBSR-Timer				ENUMERATED { sf10, sf20, sf40, sf80, sf160, sf320, sf640, sf1280, sf2560, sf5120, sf10240, spare5, spare4,
+											spare3, spare2, spare1},
+	logicalChannelSR-DelayTimer		ENUMERATED { sf20, sf40, sf64, sf128, sf512, sf1024, sf2560, spare1}	OPTIONAL	-- Need R
+}
+
+
+
+-- TAG-MAC-CELL-GROUP-CONFIG-STOP
+-- TAG-MEAS-CONFIG-START
+
+MeasConfig ::=							SEQUENCE {
+	-- Measurement objects
+	measObjectToRemoveList					MeasObjectToRemoveList											OPTIONAL,	-- Need N
+	measObjectToAddModList					MeasObjectToAddModList											OPTIONAL,	-- Need N
+
+	-- Reporting configurations
+	reportConfigToRemoveList				ReportConfigToRemoveList										OPTIONAL,	-- Need N
+	reportConfigToAddModList				ReportConfigToAddModList										OPTIONAL,	-- Need N
+
+	-- Measurement identities
+	measIdToRemoveList						MeasIdToRemoveList												OPTIONAL,	-- Need N
+	measIdToAddModList						MeasIdToAddModList												OPTIONAL,	-- Need N
+
+	-- Other parameters
+	--s-Measure config
+	s-MeasureConfig							CHOICE {
+		ssb-RSRP								RSRP-Range,						
+		csi-RSRP								RSRP-Range						
+	} 																										OPTIONAL,	-- Need M
+
+	quantityConfig						QuantityConfig														OPTIONAL,	-- Need M
+
+	--Placehold for measGapConfig
+	measGapConfig							MeasGapConfig													OPTIONAL,	-- Need M
+	...
+}
+
+MeasObjectToRemoveList ::=				SEQUENCE (SIZE (1..maxNrofObjectId)) OF MeasObjectId
+
+MeasIdToRemoveList ::=					SEQUENCE (SIZE (1..maxNrofMeasId)) OF MeasId
+
+ReportConfigToRemoveList ::=			SEQUENCE (SIZE (1..maxReportConfigId)) OF ReportConfigId
+
+-- TAG-MEAS-CONFIG-STOP
+--TAG-MEAS-GAP-CONFIG-START
+
+MeasGapConfig ::=				SEQUENCE {
+		gapFR2 						SetupRelease { GapConfig }				OPTIONAL,
+		...
+}
+
+GapConfig ::=					SEQUENCE {
+		gapOffset 					INTEGER (0..159),
+		mgl 						ENUMERATED {ms1dot5, ms3, ms3dot5, ms4, ms5dot5, ms6},
+		mgrp 						ENUMERATED {ms20, ms40, ms80, ms160},
+		mgta						ENUMERATED {ms0, ms0dot25, ms0dot5},
+		...
+}
+
+-- TAG-MEAS-GAP-CONFIG-STOP
+-- TAG-MEAS-ID-START
+
+MeasId ::=							INTEGER (1..maxNrofMeasId)
+
+-- TAG-MEAS-ID-STOP
+-- TAG-MEAS-ID-TO-ADD-MOD-LIST-START
+
+MeasIdToAddModList ::=				SEQUENCE (SIZE (1..maxNrofMeasId)) OF MeasIdToAddMod
+
+MeasIdToAddMod ::=					SEQUENCE {
+	measId								MeasId,
+	measObjectId						MeasObjectId,
+	reportConfigId						ReportConfigId
+}
+
+-- TAG-MEAS-ID-TO-ADD-MOD-LIST-STOP
+-- TAG-MEAS-OBJECT-ID-START
+
+MeasObjectId ::=							INTEGER (1..maxNrofObjectId)
+
+-- TAG-MEAS-OBJECT-ID-STOP
+-- TAG-MEAS-OBJECT-NR-START
+
+MeasObjectNR ::=							SEQUENCE {
+	ssbFrequency								ARFCN-ValueNR															OPTIONAL,
+	refFreqCSI-RS								ARFCN-ValueNR															OPTIONAL,
+
+	--RS configuration (e.g. SMTC window, CSI-RS resource, etc.)
+	referenceSignalConfig						ReferenceSignalConfig,													
+
+	--Consolidation of L1 measurements per RS index
+	absThreshSS-BlocksConsolidation			ThresholdNR																	OPTIONAL,	-- Need R
+	absThreshCSI-RS-Consolidation			ThresholdNR																	OPTIONAL,	-- Need R
+																													
+	--Config for cell measurement derivation
+	nrofSS-BlocksToAverage					INTEGER (2..maxNrofSS-BlocksToAverage)										OPTIONAL,	-- Need R
+	nrofCSI-RS-ResourcesToAverage			INTEGER (2..maxNrofCSI-RS-ResourcesToAverage)								OPTIONAL,	-- Need R
+																															
+	-- Filter coefficients applicable to this measurement object
+	quantityConfigIndex							INTEGER (1..maxNrofQuantityConfig),
+
+	--Frequency-specific offsets 
+	offsetFreq									Q-OffsetRangeList,
+
+	-- Cell list
+	cellsToRemoveList							PCI-List																OPTIONAL,	-- Need N
+	cellsToAddModList							CellsToAddModList														OPTIONAL,	-- Need N
+
+	-- Black list
+	blackCellsToRemoveList						PCI-RangeIndexList														OPTIONAL,	-- Need N
+	blackCellsToAddModList						BlackCellsToAddModList													OPTIONAL,	-- Need N
+
+	-- White list
+	whiteCellsToRemoveList						PCI-RangeIndexList														OPTIONAL,	-- Need N
+	whiteCellsToAddModList						WhiteCellsToAddModList													OPTIONAL,	-- Need N
+	...
+}
+
+ReferenceSignalConfig::=     			SEQUENCE {
+	
+
+	-- SSB configuration for mobility (nominal SSBs, timing configuration)
+	ssb-ConfigMobility						SSB-ConfigMobility				OPTIONAL,	-- Need M
+	-- CSI-RS resources to be used for CSI-RS based RRM measurements
+	csi-rs-ResourceConfigMobility			SetupRelease { CSI-RS-ResourceConfigMobility } OPTIONAL-- Need M		
+
+}
+
+-- A measurement timing configuration
+SSB-ConfigMobility::= 	SEQUENCE {
+		--Only the values 15, 30 or 60 kHz  (<6GHz), 60 or 120 kHz (>6GHz) are applicable
+		subcarrierSpacing                    SubcarrierSpacing,
+		-- The set of SS blocks to be measured within the SMTC measurement duration. 
+		-- Corresponds to L1 parameter 'SSB-measured' (see FFS_Spec, section FFS_Section)
+		-- When the field is absent the UE measures on all SS-blocks 
+		-- FFS_CHECK: Is this IE placed correctly.
+		ssb-ToMeasure							SetupRelease { SSB-ToMeasure }								OPTIONAL,	-- Need M
+
+	-- Indicates whether the UE can utilize serving cell timing to derive the index of SS block transmitted by neighbour cell:
+	useServingCellTimingForSync				BOOLEAN,
+																									
+	-- Primary measurement timing configuration. Applicable for intra- and inter-frequency measurements. 
+	smtc1									SEQUENCE {
+		-- Periodicity and offset of the measurement window in which to receive SS/PBCH blocks. 
+		-- Periodicity and offset are given in number of subframes.
+		-- FFS_FIXME: This does not match the L1 parameter table! They seem to intend an index to a hidden table in L1 specs. 
+		-- (see 38.213, section REF):
+		periodicityAndOffset					CHOICE {
+			sf5										INTEGER (0..4),
+			sf10									INTEGER (0..9),
+			sf20									INTEGER (0..19),
+			sf40									INTEGER (0..39),
+			sf80									INTEGER (0..79),
+			sf160									INTEGER (0..159)
+		},
+		-- Duration of the measurement window in which to receive SS/PBCH blocks. It is given in number of subframes 
+		-- (see 38.213, section 4.1)
+		duration								ENUMERATED { sf1, sf2, sf3, sf4, sf5 }
+	},
+
+	-- Secondary measurement timing confguration for explicitly signalled PCIs. It uses the offset and duration from smtc1.
+	-- It is supported only for intra-frequency measurements in RRC CONNECTED. 
+	smtc2 									SEQUENCE {
+		-- PCIs that are known to follow this SMTC.
+		pci-List								SEQUENCE (SIZE (1..maxNrofPCIsPerSMTC)) OF PhysCellId		OPTIONAL,	-- Need M
+		-- Periodicity for the given PCIs. Timing offset and Duration as provided in smtc1.
+		periodicity								ENUMERATED {sf5, sf10, sf20, sf40, sf80, sf160, spare2, spare1}
+	}																										OPTIONAL,-- Cond IntraFreqConnected
+	ss-RSSI-Measurement							SEQUENCE {
+		measurementSlots							CHOICE {
+			kHz15										BIT STRING (SIZE(1)),
+			kHz30										BIT STRING (SIZE(2)),
+			kHz60										BIT STRING (SIZE(4)),
+			kHz120										BIT STRING (SIZE(8))
+		},
+		endSymbol									INTEGER(0..13)
+	}																										OPTIONAL				
+}
+
+CSI-RS-ResourceConfigMobility ::= 		SEQUENCE {
+	-- MO specific values
+		isServingCellMO						BOOLEAN,
+	-- Subcarrier spacing of CSI-RS. 
+	-- Only the values 15, 30 or 60 kHz  (<6GHz), 60 or 120 kHz (>6GHz) are applicable.
+	-- Corresponds to L1 parameter 'Numerology' (see 38.211, section FFS_Section)
+	subcarrierSpacing						SubcarrierSpacing,
+	-- List of cells
+	csi-RS-CellList-Mobility 	SEQUENCE (SIZE (1..maxNrofCSI-RS-CellsRRM))	OF CSI-RS-CellMobility
+
+}
+
+CSI-RS-CellMobility ::=				SEQUENCE {
+	cellId									PhysCellId,
+
+	csi-rs-MeasurementBW					SEQUENCE {
+		-- Allowed size of the measurement BW in PRBs
+		-- Corresponds to L1 parameter 'CSI-RS-measurementBW-size' (see FFS_Spec, section FFS_Section)
+		nrofPRBs			ENUMERATED { size24, size48, size96, size192, size264},
+		-- Starting PRB index of the measurement bandwidth
+		-- Corresponds to L1 parameter 'CSI-RS-measurement-BW-start' (see FFS_Spec, section FFS_Section)
+		-- FFS_Value: Upper edge of value range unclear in RAN1
+		startPRB			INTEGER(0..2169)
+	},
+
+	-- Frequency domain density for the 1-port CSI-RS for L3 mobility
+	-- Corresponds to L1 parameter 'Density' (see FFS_Spec, section FFS_Section)
+	density									ENUMERATED {d1,d3}												OPTIONAL,
+
+
+-- List of resources
+	csi-rs-ResourceList-Mobility 	SEQUENCE (SIZE (1..maxNrofCSI-RS-ResourcesRRM))	OF CSI-RS-Resource-Mobility
+}
+
+
+CSI-RS-Resource-Mobility ::=			SEQUENCE {
+	csi-RS-Index							CSI-RS-Index,
+	-- Contains periodicity and slot offset for periodic/semi-persistent CSI-RS (see 38.211, section x.x.x.x)FFS_Ref
+	slotConfig								CHOICE {
+		ms4										INTEGER (0..31),
+		ms5										INTEGER (0..39),
+		ms10									INTEGER (0..79),
+		ms20									INTEGER (0..159),
+		ms40									INTEGER (0..319)
+	},
+	-- Each CSI-RS resource may be associated with one SSB. If such SSB is indicated, the NW also indicates whether the UE may assume 
+	-- quasi-colocation of this SSB with this CSI-RS reosurce. 
+	-- Corresponds to L1 parameter 'Associated-SSB' (see FFS_Spec, section FFS_Section)
+	
+	associatedSSB							SEQUENCE {
+		ssb-Index								SSB-Index,
+		-- The CSI-RS resource is either QCL’ed not QCL’ed with the associated SSB in spatial parameters
+		-- Corresponds to L1 parameter 'QCLed-SSB' (see FFS_Spec, section FFS_Section)
+		isQuasiColocated						BOOLEAN
+	}					OPTIONAL, -- Cond AssociatedSSB
+
+	
+	-- Frequency domain allocation within a physical resource block in accordance with 38.211, section 7.4.1.5.3 including table 7.4.1.5.2-1.
+	-- The number of bits that may be set to one depend on the chosen row in that table. For the choice "other", the row can be determined from
+	-- the parmeters below and from the number of bits set to 1 in frequencyDomainAllocation.
+	frequencyDomainAllocation			CHOICE {
+		row1								BIT STRING (SIZE (4)),
+		row2								BIT STRING (SIZE (12))
+	},
+
+	
+	-- Time domain allocation within a physical resource block. The field indicates the first OFDM symbol in the PRB used for CSI-RS.
+	-- Parameter l0 in 38.211, section 7.4.1.5.3. Value 2 is supported only when DL-DMRS-typeA-pos equals 3.
+	firstOFDMSymbolInTimeDomain			INTEGER (0..13),	
+	-- Scrambling ID for CSI-RS(see 38.211, section 7.4.1.5.2)
+	sequenceGenerationConfig				INTEGER (0..1023),
+	...
+}
+
+CSI-RS-Index ::= 				INTEGER (0..maxNrofCSI-RS-ResourcesRRM-1)
+
+Q-OffsetRangeList ::=					SEQUENCE {
+	rsrpOffsetSSB							Q-OffsetRange				DEFAULT dB0,
+	rsrqOffsetSSB							Q-OffsetRange				DEFAULT dB0,
+	sinrOffsetSSB							Q-OffsetRange				DEFAULT dB0,
+	rsrpOffsetCSI-RS						Q-OffsetRange				DEFAULT dB0,
+	rsrqOffsetCSI-RS						Q-OffsetRange				DEFAULT dB0,
+	sinrOffsetCSI-RS						Q-OffsetRange				DEFAULT dB0
+}
+
+SSB-ToMeasure ::=			CHOICE {
+	-- bitmap for sub 3 GHz
+	shortBitmap							BIT STRING (SIZE (4)),
+	-- bitmap for 3-6 GHz
+	mediumBitmap						BIT STRING (SIZE (8)),
+	-- bitmap for above 6 GHz
+	longBitmap							BIT STRING (SIZE (64))
+}
+
+
+ThresholdNR ::=							SEQUENCE{
+	thresholdRSRP							RSRP-Range					OPTIONAL,
+	thresholdRSRQ						RSRQ-Range					OPTIONAL,
+	thresholdSINR						SINR-Range					OPTIONAL
+}
+
+CellsToAddModList ::=					SEQUENCE (SIZE (1..maxNrofCellMeas)) OF CellsToAddMod
+
+CellsToAddMod ::=						SEQUENCE {
+	physCellId								PhysCellId,
+	cellIndividualOffset					Q-OffsetRangeList
+}
+
+BlackCellsToAddModList ::=				SEQUENCE (SIZE (1..maxNrofPCI-Ranges)) OF BlackCellsToAddMod
+
+BlackCellsToAddMod ::=					SEQUENCE {
+	pci-RangeIndex							PCI-RangeIndex,		
+	pci-Range								PCI-Range
+}
+
+
+WhiteCellsToAddModList ::=				SEQUENCE (SIZE (1..maxNrofPCI-Ranges)) OF WhiteCellsToAddMod
+
+WhiteCellsToAddMod ::=					SEQUENCE {
+	pci-RangeIndex							PCI-RangeIndex,
+	pci-Range							PCI-Range
+}
+
+-- TAG-MEAS-OBJECT-NR-STOP
+-- TAG-MEAS-OBJECT-TO-ADD-MOD-LIST-START
+
+MeasObjectToAddModList ::=					SEQUENCE (SIZE (1..maxNrofObjectId)) OF MeasObjectToAddMod
+
+MeasObjectToAddMod ::=						SEQUENCE {
+	measObjectId								MeasObjectId,
+	measObject									CHOICE {
+		measObjectNR								MeasObjectNR,
+		...
+	}
+}
+
+-- TAG-MEAS-OBJECT-TO-ADD-MOD-LIST-STOP 
+-- TAG-MEAS-RESULTS-START
+
+MeasResults ::=								SEQUENCE {
+	measId										MeasId,
+	measResultServingFreqList					MeasResultServFreqList,
+	measResultNeighCells						CHOICE {
+		measResultListNR							MeasResultListNR,
+		...
+	}																														OPTIONAL,
+	...
+}
+
+MeasResultServFreqList ::=					SEQUENCE (SIZE (1..maxNrofServingCells)) OF MeasResultServFreq
+
+MeasResultServFreq ::=						SEQUENCE {
+	servFreqId									ServCellIndex,																
+	measResultServingCell						MeasResultNR,
+	measResultBestNeighCell						MeasResultNR,
+	...															
+}
+
+MeasResultListNR ::=						SEQUENCE (SIZE (1..maxCellReport)) OF MeasResultNR
+
+MeasResultNR ::=							SEQUENCE {
+	physCellId									PhysCellId																	OPTIONAL,
+	--FFS: Details of cgi info 
+	cgi-Info									ENUMERATED {ffsTypeAndValue}												OPTIONAL,
+	measResult									SEQUENCE {
+		cellResults									SEQUENCE{
+			resultsSSB-Cell								MeasQuantityResults													OPTIONAL,
+			resultsCSI-RS-Cell							MeasQuantityResults													OPTIONAL
+		},
+		rsIndexResults								SEQUENCE{
+			resultsSSB-Indexes							ResultsPerSSB-IndexList												OPTIONAL, 
+			resultsCSI-RS-Indexes						ResultsPerCSI-RS-IndexList											OPTIONAL
+		}																													OPTIONAL
+	},
+	...
+}
+
+
+MeasQuantityResults ::= 		SEQUENCE {
+	rsrp							RSRP-Range													OPTIONAL,
+	rsrq							RSRQ-Range													OPTIONAL,
+	sinr							SINR-Range													OPTIONAL
+}
+
+ResultsPerSSB-IndexList::= 				SEQUENCE (SIZE (1..maxNrofSSBs)) OF ResultsPerSSB-Index
+
+ResultsPerSSB-Index ::= 					SEQUENCE {
+	ssb-Index									SSB-Index,
+	ssb-Results									MeasQuantityResults							OPTIONAL
+}
+
+ResultsPerCSI-RS-IndexList::= 				SEQUENCE (SIZE (1..maxNrofCSI-RS)) OF ResultsPerCSI-RS-Index
+
+ResultsPerCSI-RS-Index ::= 					SEQUENCE {
+	csi-RS-Index								CSI-RS-Index,
+	csi-RS-Results								MeasQuantityResults							OPTIONAL
+}
+
+-- TAG-MEAS-RESULTS-STOP
+-- TAG-MEAS-RESULT-SCG-FAILURE-START
+
+MeasResultSCG-Failure ::= 			SEQUENCE {
+	measResultServFreqList					MeasResultServFreqList2NR,
+	measResultNeighCells						MeasResultList2NR,
+	...
+}
+
+MeasResultServFreqList2NR ::=			SEQUENCE (SIZE (1..maxNrofServingCells)) OF MeasResultServFreq2NR
+
+MeasResultServFreq2NR ::=				SEQUENCE {
+	ssbFrequency							ARFCN-ValueNR			OPTIONAL,
+	refFreqCSI-RS							ARFCN-ValueNR			OPTIONAL,
+	measResultServingCell					MeasResultNR,
+	measResultBestNeighCell					MeasResultNR		OPTIONAL
+}
+
+MeasResultList2NR ::=					SEQUENCE (SIZE (1..maxFreq)) OF MeasResult2NR
+
+MeasResult2NR ::=						SEQUENCE {	
+	ssbFrequency							ARFCN-ValueNR			OPTIONAL,
+	refFreqCSI-RS							ARFCN-ValueNR			OPTIONAL,
+	measResultListNR						MeasResultListNR
+}
+
+-- TAG-MEAS-RESULT-SCG-FAILURE-STOP
+-- TAG-MEASRESULT-CELL-LIST-SFTD-START
+
+MeasResultCellListSFTD ::=			SEQUENCE (SIZE (1..maxCellSFTD)) OF MeasResultCellSFTD
+
+MeasResultCellSFTD ::=	SEQUENCE {
+	physCellId							PhysCellId,
+	sfn-OffsetResult					INTEGER (0..1023),
+	frameBoundaryOffsetResult			INTEGER (-30720..30719),
+	rsrp-Result							RSRP-Range						OPTIONAL
+}
+
+-- TAG-MEASRESULT-CELL-LIST-SFTD-STOP
+-- TAG-MULTIFREQUENCYBANDLISTNR-START
+
+MultiFrequencyBandListNR ::= 		SEQUENCE (SIZE (1..maxNrofMultiBands)) OF FreqBandIndicatorNR
+
+-- TAG-MULTIFREQUENCYBANDLISTNR-STOP
+-- TAG-NZP-CSI-RS-RESOURCESET-START
+NZP-CSI-RS-ResourceSet ::= 		SEQUENCE {
+	nzp-CSI-ResourceSetId					NZP-CSI-RS-ResourceSetId,	
+
+	-- NZP-CSI-RS-Resources assocaited with this NZP-CSI-RS resource set.
+	-- Corresponds to L1 parameter 'CSI-RS-ResourceConfigList' (see 38.214, section 5.2)
+	-- For CSI, there are at most 8 NZP CSI RS resources per resource set
+	nzp-CSI-RS-Resources						SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourcesPerSet)) OF NZP-CSI-RS-ResourceId,
+
+	-- Indicates whether repetition is on/off. If set to set to 'OFF', the UE may not assume that the 
+	-- NZP-CSI-RS resources within the resource set are transmitted with the same downlink spatial domain transmission filter 
+	-- and with same NrofPorts in every symbol.
+	-- Corresponds to L1 parameter 'CSI-RS-ResourceRep' (see 38.214, sections 5.2.2.3.1 and 5.1.6.1.2)
+	-- Can only be configured for CSI-RS resource sets which are associated with CSI-ReportConfig with report of L1 RSRP or “no report”	
+	repetition									ENUMERATED { on, off }				OPTIONAL,
+
+	-- Offset X between the slot containing the DCI that triggers a set of aperiodic NZP CSI-RS resources and the slot in which the 
+	-- CSI-RS resource set is transmitted. When the field is absent the UE applies the value 0.
+	-- Corresponds to L1 parameter 'Aperiodic-NZP-CSI-RS-TriggeringOffset' (see 38,214, section FFS_Section)
+	aperiodicTriggeringOffset			 		INTEGER(0..4)																		OPTIONAL,	-- Need S
+
+	-- Indicates that the antenna port for all NZP-CSI-RS resources in the CSI-RS resource set is same.
+	-- Corresponds to L1 parameter 'TRS-Info' (see 38.214, section 5.2.2.3.1)
+	trs-Info								ENUMERATED {true}																OPTIONAL,
+	...
+}
+
+-- TAG-NZP-CSI-RS-RESOURCESET-STOP
+-- TAG-NZP-CSI-RS-RESOURCESETID-START
+NZP-CSI-RS-ResourceSetId ::= INTEGER (0..maxNrofNZP-CSI-RS-ResourceSets-1)
+
+-- TAG-NZP-CSI-RS-RESOURCESETID-STOP
+-- TAG-NZP-CSI-RS-RESOURCE-START
+NZP-CSI-RS-Resource ::=		SEQUENCE {
+	nzp-CSI-RS-ResourceId				NZP-CSI-RS-ResourceId,
+
+	-- OFDM symbol location(s) in a slot and subcarrier occupancy in a PRB of the CSI-RS resource	
+	resourceMapping							CSI-RS-ResourceMapping,
+	-- Power offset of NZP CSI-RS RE to PDSCH RE. Value in dB. Corresponds to L1 parameter Pc (see 38.214, sections 5.2.2.3.1 and 4.1)
+	powerControlOffset						INTEGER(-8..15),
+	-- Power offset of NZP CSI-RS RE to SS RE. Value in dB. Corresponds to L1 parameter 'Pc_SS' (see 38.214, section 5.2.2.3.1)
+	powerControlOffsetSS					ENUMERATED{db-3, db0, db3, db6}								OPTIONAL,	
+	-- Scrambling ID (see 38.214, section 5.2.2.3.1)
+	scramblingID							ScramblingId,
+
+	-- Periodicity and slot offset sl1 corresponds to a periodicity of 1 slot, sl2 to a periodicity of two slots, and so on. 
+	-- The corresponding offset is also given in number of slots. Corresponds to L1 parameter 'CSI-RS-timeConfig' (see 38.214, section 5.2.2.3.1)
+	periodicityAndOffset					CSI-ResourcePeriodicityAndOffset							OPTIONAL, --Cond PeriodicOrSemiPersistent
+
+	-- For a target periodic CSI-RS, contains a reference to one TCI-State in TCI-States for providing the QCL source and 
+	-- QCL type. For periodic CSI-RS, the source can be SSB or another periodic-CSI-RS.
+	-- Corresponds to L1 parameter 'QCL-Info-PeriodicCSI-RS' (see 38.214, section 5.2.2.3.1)
+	qcl-InfoPeriodicCSI-RS						TCI-StateId												OPTIONAL, --Cond Periodic
+	...
+}
+
+-- TAG-NZP-CSI-RS-RESOURCE-STOP
+-- TAG-NZP-CSI-RS-RESOURCEID-START
+NZP-CSI-RS-ResourceId ::= 					INTEGER (0..maxNrofNZP-CSI-RS-Resources-1)
+
+-- TAG-NZP-CSI-RS-RESOURCEID-STOP
+-- TAG-P-MAX-START
+
+P-Max ::=				INTEGER (-30..33)
+
+-- TAG-P-MAX-STOP
+-- TAG-PCI-LIST-START
+
+PCI-List ::=						SEQUENCE (SIZE (1..maxNrofCellMeas)) OF PhysCellId
+
+-- TAG-PCI-LIST-STOP
+-- TAG-PCI-RANGE-START
+
+PCI-Range ::=				SEQUENCE {
+	start							PhysCellId,
+	range							ENUMERATED {
+										n4, n8, n12, n16, n24, n32, n48, n64, n84,
+										n96, n128, n168, n252, n504, n1008,
+										spare1} 					OPTIONAL	-- Need Nss
+}
+
+-- TAG-PCI-RANGE-STOP
+-- TAG-PCI-RANGE-INDEX-START
+
+PCI-RangeIndex ::=						INTEGER (1..maxNrofPCI-Ranges)
+
+
+-- TAG-PCI-RANGE-INDEX-STOP
+-- TAG-PCI-RANGE-INDEX-LIST-START
+
+PCI-RangeIndexList ::=						SEQUENCE (SIZE (1..maxNrofPCI-Ranges)) OF PCI-RangeIndex
+
+-- TAG-PCI-Range-INDEX-LIST-STOP
+-- TAG-PDCCH-CONFIG-START
+
+PDCCH-Config ::= 						SEQUENCE {
+	-- List of UE specifically configured Control Resource Sets (CORESETs) to be used by the UE.
+	-- The network configures at most 3 CORESETs per BWP per cell (including the initial CORESET).
+	controlResourceSetToAddModList			SEQUENCE(SIZE (1..3)) OF ControlResourceSet 		OPTIONAL,
+	controlResourceSetToReleaseList			SEQUENCE(SIZE (1..3)) OF ControlResourceSetId			OPTIONAL,
+
+	-- List of UE specifically configured Control Resource Sets (CORESETs).
+	-- The network configures at most 10 Search Spaces per BWP per cell (including the initial Search Space).
+	searchSpacesToAddModList				SEQUENCE(SIZE (1..10)) OF SearchSpace						OPTIONAL,
+	searchSpacesToReleaseList				SEQUENCE(SIZE (1..10)) OF SearchSpaceId						OPTIONAL,
+
+	-- Configuration of downlink preemtption indications to be monitored in this cell. 
+	-- Corresponds to L1 parameter 'Preemp-DL' (see 38.214, section 11.2)
+	-- FFS_RAN1: LS R1-1801281 indicates this is "Per Cell (but association with each configured BWP is needed)" => Unclear, keep on BWP for now.
+	downlinkPreemption						SetupRelease { DownlinkPreemption }															OPTIONAL,	-- Need M
+
+	-- Configuration of Slot-Format-Indicators to be monitored in this cell
+
+	-- FFS_RAN1 discusses still whether this SFI payload configuration is BWP- or Cell-Specific. 
+	slotFormatIndicator						SetupRelease { SlotFormatIndicator }															OPTIONAL,	-- Need M
+	-- Enable and configure reception of group TPC commands for PUSCH
+	tpc-PUSCH								SetupRelease { PUSCH-TPC-CommandConfig }							OPTIONAL,   -- Need M
+
+	-- Enable and configure reception of group TPC commands fpr PUCCH
+	tpc-PUCCH								SetupRelease { PUCCH-TPC-CommandConfig }							OPTIONAL,   -- Cond PUCCH-CellOnly
+
+	...
+}
+
+-- TAG-PDCCH-CONFIG-STOP 
+-- TAG-PDCCH-CONFIGCOMMON-START
+
+PDCCH-ConfigCommon ::=					SEQUENCE {
+
+	-- A list of common control resource sets. Only CORESETs with ControlResourceSetId = 0 or 1 are allowed. The CORESET#0 
+	-- corresponds to the CORESET configured in MIB (see pdcch-ConfigSIB1) and is used to provide that information to the UE
+	-- by dedicated signalling during handover and (P)SCell addition. The CORESET#1 may be configured an used for RAR 
+	-- (see ra-ControlResourceSet).
+	commonControlResourcesSets					SEQUENCE (SIZE(1..2)) OF ControlResourceSet							OPTIONAL, 	-- Need R
+
+	-- A list of additional common search spaces.
+	commonSearchSpaces							SEQUENCE (SIZE(1..4)) OF SearchSpace								OPTIONAL,	-- Need R
+
+	-- ID of the search space for SIB1 message.
+	
+	-- Corresponds to L1 parameter 'rmsi-SearchSpace' (see 38.213, section 10)
+	searchSpaceSIB1								SearchSpaceId														OPTIONAL,	-- Need R
+	-- ID of the Search space for other system information, i.e., SIB2 and beyond. 
+	-- Corresponds to L1 parameter 'osi-SearchSpace' (see 38.213, section 10)
+	-- If the field is absent, the monitoring occasions are derived as described in 38.213, section 10.1 and section 13.
+	searchSpaceOtherSystemInformation			SearchSpaceId														OPTIONAL,	-- Need R
+	
+	-- ID of the Search space for paging. Corresponds to L1 parameter 'paging-SearchSpace' (see 38.213, section 10)
+	-- If the field is absent, the monitoring occasions are derived as described in 38.213, section 10.1 and section 13.
+	pagingSearchSpace							SearchSpaceId														OPTIONAL, 	-- Need R
+
+	-- CORESET configured for random access. When the field is absent the UE uses the CORESET according to pdcch-ConfigSIB1
+	-- which is associated with ControlResourceSetId = 0.
+	-- Corresponds to L1 parameter 'rach-coreset-configuration' (see 38.211?, section FFS_Section)
+	ra-ControlResourceSet					ControlResourceSetId																OPTIONAL, 	-- Need S
+	-- ID of the Search space for random access procedure. Corresponds to L1 parameter 'ra-SearchSpace' (see 38.214?, section FFS_Section)
+	-- If the field is absent, the monitoring occasions are derived as described in 38.213, section 10.1 and section 13.
+	ra-SearchSpace							SearchSpaceId																	OPTIONAL, 	-- Need R
+	...
+
+}
+
+-- TAG-PDCCH-CONFIGCOMMON-STOP
+-- TAG-PDCP-CONFIG-START
+
+PDCP-Config ::=			SEQUENCE {
+	drb						SEQUENCE {
+		discardTimer			ENUMERATED {ms10, ms20, ms30, ms40, ms50, ms60, ms75, ms100, ms150, ms200, ms250, ms300, ms500, ms750, ms1500, infinity} 													OPTIONAL, -- Cond Setup
+		pdcp-SN-SizeUL			ENUMERATED {len12bits, len18bits}				OPTIONAL, -- Cond Setup2
+		pdcp-SN-SizeDL			ENUMERATED {len12bits, len18bits}				OPTIONAL, -- Cond Setup2
+		headerCompression		CHOICE {
+			notUsed					NULL,
+			rohc					SEQUENCE {
+				maxCID					INTEGER (1..16383)				DEFAULT 15,
+				profiles				SEQUENCE {
+					profile0x0001			BOOLEAN,
+					profile0x0002			BOOLEAN,
+					profile0x0003			BOOLEAN,
+					profile0x0004			BOOLEAN,
+					profile0x0006			BOOLEAN,
+					profile0x0101			BOOLEAN,
+					profile0x0102			BOOLEAN,
+					profile0x0103			BOOLEAN,
+					profile0x0104			BOOLEAN
+				},
+				drb-ContinueROHC			BOOLEAN 
+			},
+			uplinkOnlyROHC			SEQUENCE {
+				maxCID					INTEGER (1..16383)				DEFAULT 15,
+				profiles				SEQUENCE {
+					profile0x0006			BOOLEAN
+				},
+				drb-ContinueROHC			BOOLEAN 
+			},
+			...
+		},
+		integrityProtection		ENUMERATED { enabled }														OPTIONAL,	-- Cond ConnectedTo5GC
+		statusReportRequired	ENUMERATED { true }															OPTIONAL,	-- Cond Rlc-AM
+		outOfOrderDelivery		BOOLEAN
+	}																											OPTIONAL,	-- Cond DRB
+	-- FFS / TODO: Handle more than two secondary cell groups
+	moreThanOneRLC			SEQUENCE {
+		primaryPath				SEQUENCE {
+			cellGroup				CellGroupId											OPTIONAL,	-- Need R
+			logicalChannel			LogicalChannelIdentity								OPTIONAL	-- Need R
+		},
+		ul-DataSplitThreshold	UL-DataSplitThreshold 									OPTIONAL, -- Cond SplitBearer						
+		pdcp-Duplication			ENUMERATED { true }													OPTIONAL	-- Need R
+	}																										OPTIONAL, -- Cond MoreThanOneRLC
+
+	t-Reordering				ENUMERATED {
+									ms0, ms1, ms2, ms4, ms5, ms8, ms10, ms15, ms20, ms30, ms40, ms50, ms60, ms80, ms100, ms120, ms140, ms160, ms180, ms200, ms220, 
+									ms240, ms260, ms280, ms300,	ms500, ms750, ms1000, ms1250, ms1500, ms1750, ms2000, ms2250, ms2500, ms2750,
+									ms3000, spare28, spare27, spare26, spare25, spare24, spare23, spare22, spare21, spare20,
+									spare19, spare18, spare17, spare16, spare15, spare14, spare13, spare12, spare11, spare10, spare09,
+									spare08, spare07, spare06, spare05, spare04, spare03, spare02, spare01 }		OPTIONAL, -- Need S
+
+	
+	...
+}
+
+UL-DataSplitThreshold ::= ENUMERATED { 
+											b0, b100, b200, b400, b800, b1600, b3200, b6400, b12800, b25600, b51200, b102400, b204800, 
+											b409600, b819200, b1228800, b1638400, b2457600, b3276800, b4096000, b4915200, b5734400, 
+											b6553600, infinity, spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1}
+
+-- TAG-PDCP-CONFIG-STOP
+-- TAG-PDSCH-CONFIG-START
+
+PDSCH-Config ::= 						SEQUENCE {
+	-- Identifer used to initalite data scrambling (c_init) for both PDSCH.
+	-- Corresponds to L1 parameter 'Data-scrambling-Identity' (see 38,214, section FFS_Section)
+	-- FFS:_Replace by tye ScramblingId used in other places?
+	dataScramblingIdentityPDSCH			INTEGER (0..1007)															OPTIONAL,
+
+	-- DMRS configuration for PDSCH transmissions using PDSCH mapping type A (chosen dynamically via PDSCH-TimeDomainResourceAllocation).
+	dmrs-DownlinkForPDSCH-MappingTypeA			SetupRelease { DMRS-DownlinkConfig }										OPTIONAL,	-- Need M
+	-- DMRS configuration for PDSCH transmissions using PDSCH mapping type B (chosen dynamically via PDSCH-TimeDomainResourceAllocation).
+	dmrs-DownlinkForPDSCH-MappingTypeB			SetupRelease { DMRS-DownlinkConfig } 							OPTIONAL,	-- Need M
+
+
+	-- A list of Transmission Configuration Indicator (TCI) states for dynamically indicating (over DCI) a transmission configuration 
+	-- which includes QCL-relationships between the DL RSs in one RS set and the PDSCH DMRS ports 
+	-- (see 38.214, section 5.1.4)
+	tci-StatesToAddModList					SEQUENCE (SIZE(1..maxNrofTCI-States)) OF TCI-State					OPTIONAL,	-- Need N
+	tci-StatesToReleaseList					SEQUENCE (SIZE(1..maxNrofTCI-States)) OF TCI-StateId						OPTIONAL,	-- Need N
+
+	-- Interleaving unit configurable between 2 and 4 PRBs
+	-- Corresponds to L1 parameter 'VRB-to-PRB-interleaver' (see 38.211, section 6.3.1.6)
+	vrb-ToPRB-Interleaver					ENUMERATED {n2, n4},
+
+	-- Configuration of resource allocation type 0 and resource allocation type 1 for non-fallback DCI
+	-- Corresponds to L1 parameter 'Resouce-allocation-config' (see 38.214, section 5.1.2)
+	resourceAllocation						ENUMERATED { resourceAllocationType0, 
+resourceAllocationType1, 
+dynamicSwitch},
+
+	-- List of time-domain configurations for timing of DL assignment to DL data. If configured, the values provided herein 
+	-- override the values received in corresponding PDSCH-ConfigCommon.
+	pdsch-AllocationList			SEQUENCE (SIZE(1..maxNrofDL-Allocations)) OF PDSCH-TimeDomainResourceAllocation		OPTIONAL,	-- Need R
+	-- Number of repetitions for data. Corresponds to L1 parameter 'aggregation-factor-DL' (see 38.214, section FFS_Section)
+	-- When the field is absent the UE applies the value 1
+	pdsch-AggregationFactor					ENUMERATED { n2, n4, n8 }													OPTIONAL,	-- Need S
+
+	-- Resources patterns which the UE should rate match PDSCH around. The UE rate matches around the union of all resources 
+	-- indicated in the nexted bitmaps. Corresponds to L1 parameter 'Resource-set-BWP' (see 38.214, section 5.1.2.2.3)
+	-- FFS: RAN1 indicates that there should be a set of patterns per cell and one per BWP => Having both seems unnecessary.
+
+	rateMatchPatternToAddModList			SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPattern											OPTIONAL, -- Need N
+	rateMatchPatternToReleaseList			SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId		OPTIONAL, -- Need N
+
+	-- The IDs of a first group of RateMatchPatterns defined in the rateMatchPatternToAddModList.
+	-- Corresponds to L1 parameter 'Resource-set-group-1'. (see 38.214, section FFS_Section)
+	rateMatchPatternGroup1					SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId		OPTIONAL, -- Need R
+	-- The IDs of a second group of RateMatchPatterns defined in the rateMatchPatternToAddModList
+	-- Corresponds to L1 parameter 'Resource-set-group-2'. (see 38.214, section FFS_Section)
+	rateMatchPatternGroup2					SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId		OPTIONAL, -- Need R
+
+
+	-- Selection between config 1 and config 2 for RBG size for PDSCH. Corresponds to L1 parameter 'RBG-size-PDSCH' (see 38.214, section 5.1.2.2.1)
+	rbg-Size								ENUMERATED {config1, config2},
+
+	-- Indicates which MCS table the UE shall use for PDSCH. Corresponds to L1 parameter 'MCS-Table-PDSCH' (see 38.214, section 5.1.3.1).
+	mcs-Table								ENUMERATED {qam64, qam256},
+
+	-- Maximum number of code words that a single DCI may schedule. This changes the number of MCS/RV/NDI bits in the DCI message from 1 to 2.
+	maxNrofCodeWordsScheduledByDCI			ENUMERATED {n1, n2}															OPTIONAL, 	-- Need R
+
+
+	-- Indicates the PRB bundle type and bundle size(s). If "dynamic" is chosen, the actual BundleSizeSet to use is indicated via DCI. 
+	-- If a bundleSize(Set) value is absent, the UE applies the value n2. Corresponds to L1 parameter 'PRB_bundling' 
+	-- (see 38.214, section 5.1.2.3)
+	prb-BundlingType					CHOICE {
+		static									SEQUENCE {
+			bundleSize								ENUMERATED { n4, wideband }											OPTIONAL	-- Need S
+		},
+		dynamic 								SEQUENCE {
+			bundleSizeSet1							ENUMERATED { n4, wideband, n2-wideband, n4-wideband }				OPTIONAL,	-- Need S
+			bundleSizeSet2							ENUMERATED { n4, wideband }											OPTIONAL	-- Need S
+		}
+	},
+
+	-- A list of Zero-Power (ZP) CSI-RS resources used for PDSCH rate-matching.
+	-- Corresponds to L1 parameter 'ZP-CSI-RS-ResourceConfigList' (see 38.214, section FFS_Section)
+	zp-CSI-RS-ResourceToAddModList			SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Resources)) OF ZP-CSI-RS-Resource	OPTIONAL,	-- Need N
+	zp-CSI-RS-ResourceToReleaseList			SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Resources)) OF ZP-CSI-RS-ResourceId	OPTIONAL,	-- Need M
+
+	-- A list of sets. Each set contains a set-ID and the IDs of one or more ZP-CSI-RS-Resources (the actual resources are defined in the 
+	-- zp-CSI-RS-ResourceToAddModList). The network triggers a set by indicating its set-ID (ZP-CSI-RS-ResourceSetId) in the DCI payload.
+	-- The resources referenced in these sets are confgiured with resourceType 'aperiodic'.
+	-- Corresponds to L1 parameter ' ZP-CSI-RS-ResourceSetConfigList' (see 38.214, section FFS_Section)
+	aperiodic-ZP-CSI-RS-ResourceSetsToAddModList	SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSet		OPTIONAL,	-- Need N
+	aperiodic-ZP-CSI-RS-ResourceSetsToReleaseList	SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSetId	OPTIONAL,	-- Need N
+	
+	-- A list of sets. Each set contains a set-ID and the IDs of one or more ZP-CSI-RS-Resources (the actual resources are defined in the 
+	-- zp-CSI-RS-ResourceToAddModList). The network triggers a set by indicating its set-ID (ZP-CSI-RS-ResourceSetId) in the MAC CE.
+	-- The resources referenced in these sets are confgiured with resourceType 'semi-persistent'.
+	-- Corresponds to L1 parameter 'SP-ZP-CSI-RS-Resource-List' (see 38.214, section 5.1.4_Section)
+	sp-ZP-CSI-RS-ResourceSetsToAddModList	SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSet		OPTIONAL,	-- Need N
+	sp-ZP-CSI-RS-ResourceSetsToReleaseList	SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSetId	OPTIONAL,	-- Need N
+
+	...
+}
+
+
+
+
+-- TAG-PDSCH-CONFIG-STOP
+-- TAG-PDSCH-CONFIGCOMMON-START
+
+PDSCH-ConfigCommon ::=					SEQUENCE {
+
+	-- List of time-domain configurations for timing of DL assignment to DL data 
+	pdsch-AllocationList			SEQUENCE (SIZE(1..maxNrofDL-Allocations)) OF PDSCH-TimeDomainResourceAllocation			OPTIONAL,	-- Need R
+
+	...
+}
+
+-- TAG-PDSCH-CONFIGCOMMON-STOP
+-- TAG-PDSCH-SERVINGCELLCONFIG-START
+
+PDSCH-ServingCellConfig ::= 			SEQUENCE {
+	-- Enables and configures code-block-group (CBG) based transmission (see 38.213, section 9.1.1)
+	codeBlockGroupTransmission				SetupRelease { PDSCH-CodeBlockGroupTransmission }						OPTIONAL,	-- Need M
+	-- Accounts for overhead from CSI-RS, CORESET, etc. If the field is absent, the UE applies value xOh0.
+	-- Corresponds to L1 parameter 'Xoh-PDSCH' (see 38.214, section 5.1.3.2)
+	xOverhead								ENUMERATED { xOh6, xOh12, xOh18 }										OPTIONAL,	-- Need S
+	-- The number of HARQ processes to be used on the PDSCH of a serving cell. n2 corresponds to 2 HARQ processes, n4 to 4 HARQ processes 
+	-- and so on. If the field is absent, the UE uses 8 HARQ processes. 
+	-- Corresponds to L1 parameter 'number-HARQ-process-PDSCH' (see 38.214, section REF) 
+	nrofHARQ-ProcessesForPDSCH				ENUMERATED {n2, n4, n6, n10, n12, n16}									OPTIONAL,	-- Need S
+	-- The ID of the serving cell (of the same cell group) to use for PUCCH. 
+	-- If the field is absent, the UE sends the HARQ feedback on the PUCCH of the SpCell of this cell group. 
+	pucch-Cell								ServCellIndex															OPTIONAL	,	-- Cond SCellAddOnly
+	...
+}
+
+PDSCH-CodeBlockGroupTransmission ::=		SEQUENCE {
+	-- Maximum number of code-block-groups (CBGs) per TB. In case of multiple CW the maximum CBG is 4 (see 38.213, section 9.1.1)
+	maxCodeBlockGroupsPerTransportBlock		ENUMERATED {n2, n4, n6, n8},
+	-- Indicates whether CBGFI for CBG based (re)transmission in DL is enabled (true). (see 38.212, section 7.3.1.2.2)
+	codeBlockGroupFlushIndicator			BOOLEAN,
+	...
+}
+
+-- TAG-PDSCH-SERVINGCELLCONFIG-STOP
+-- TAG-PDSCH-TIMEDOMAINRESOURCEALLOCATION-START
+
+PDSCH-TimeDomainResourceAllocation ::= 		SEQUENCE {
+	-- Corresponds to L1 parameter 'K0' (see 38.214, section FFS_Section)
+	-- When the field is absent the UE applies the value 0
+	k0									INTEGER (1..3)																OPTIONAL,	-- Need S
+	-- PDSCH mapping type. Corresponds to L1 parameter 'Mapping-type' (see 38.214, section FFS_Section)
+	mappingType							ENUMERATED {typeA, typeB},
+	-- An index into a table/equation in RAN1 specs capturing valid combinations of start symbol and length (jointly encoded)
+	-- Corresponds to L1 parameter 'Index-start-len' (see 38.214, section FFS_Section)
+	startSymbolAndLength				BIT STRING (SIZE (7))
+}
+
+-- TAG-PDSCH-TIMEDOMAINRESOURCEALLOCATION-STOP
+-- TAG-PHYS-CELL-ID-START
+
+PhysCellId ::=						INTEGER (0..1007)
+
+-- TAG-PHYS-CELL-ID-STOP
+-- TAG-PRB-ID-START
+
+PRB-Id ::=						INTEGER (0..maxNrofPhysicalResourceBlocks-1)
+
+-- TAG-PRB-ID-STOP
+-- TAG-PTRS-DOWNLINKCONFIG-START
+
+PTRS-DownlinkConfig ::= 					SEQUENCE {
+	-- Presence and  frequency density of DL PT-RS as a function of Scheduled BW 
+	-- If the field is absent, the UE uses K_PT-RS = 2.
+	-- Corresponds to L1 parameter 'DL-PTRS-frequency-density-table' (see 38.214, section 5.1)
+	frequencyDensity							SEQUENCE (SIZE (2)) OF INTEGER (1..276)			OPTIONAL,	-- Need S
+	-- Presence and time density of DL PT-RS  as a function of MCS. The value 29 is only applicable for MCS Table 5.1.3.1-1 (38.214)
+	-- If the field is absent, the UE uses L_PT-RS = 1.
+	-- Corresponds to L1 parameter 'DL-PTRS-time-density-table' (see 38.214, section 5.1)
+	timeDensity									SEQUENCE (SIZE (3)) OF INTEGER (0..29)		OPTIONAL, 	-- Need S
+	-- EPRE ratio between PTRS and PDSCH. Value 0 correspond to the codepoint ”00” in table 4.1-2. Value 1 corresponds to codepoint ”01” 
+	-- If the field is not provided, the UE applies value 0. Corresponds to L1 parameter 'DL-PTRS-EPRE-ratio' (see 38.214, section 4.1)
+	epre-RatioPort1								INTEGER (0..3)															OPTIONAL,	-- Need S
+	-- EPRE ratio between PTRS and PDSCH. Value 0 correspond to the codepoint ”00” in table 4.1-2. Value 1 corresponds to codepoint ”01”.
+	-- If the field is not provided, the UE applies value 0. Corresponds to L1 parameter 'DL-PTRS-EPRE-ratio' (see 38.214, section 4.1)
+	epre-RatioPort2								SEQUENCE (SIZE (1..2)) OF INTEGER (0..3)								OPTIONAL,	-- Cond TwoPorts
+	-- Indicates the subcarrier offset for DL PTRS. If the field is absent, the UE applies the value offset00.
+	-- Corresponds to L1 parameter 'DL-PTRS-RE-offset' (see 38.214, section 5.1.6.3)
+	resourceElementOffset						ENUMERATED { offset01, offset10, offset11 }							OPTIONAL,	-- Need S
+	...
+}
+
+-- TAG-PTRS-DOWNLINKCONFIG-STOP
+-- TAG-PTRS-UPLINKCONFIG-START
+
+PTRS-UplinkConfig ::= 					SEQUENCE { 
+
+	modeSpecificParameters					CHOICE {
+		-- Configuration of UL PTRS for CP-OFDM
+		cp-OFDM									SEQUENCE {
+			-- Presence and  frequency density of UL PT-RS for CP-OFDM waveform as a function of scheduled BW 
+			-- If the field is absent, the UE uses K_PT-RS = 2.
+			-- Corresponds to L1 parameter 'UL-PTRS-frequency-density-table' (see 38.214, section 6.1)
+			frequencyDensity						SEQUENCE (SIZE (2)) OF INTEGER (1..276)		OPTIONAL,	-- Need S
+			-- Presence and time density of UL PT-RS for CP-OFDM waveform as a function of MCS 
+				-- If the field is absent, the UE uses L_PT-RS = 1.
+			-- Corresponds to L1 parameter 'UL-PTRS-time-density-table' (see 38.214, section 6.1)
+			timeDensity								SEQUENCE (SIZE (3)) OF INTEGER (0..29)		OPTIONAL, 	-- Need S
+			-- The maximum number of UL PTRS ports for CP-OFDM. 
+			-- Corresponds to L1 parameter 'UL-PTRS-ports' (see 38.214, section 6.2.3.1)
+			maxNrofPorts								ENUMERATED {n1, n2},
+			-- Indicates the subcarrier offset for UL PTRS for CP-OFDM. 
+			-- Corresponds to L1 parameter 'UL-PTRS-RE-offset' (see 38.214, section 6.1)
+			resourceElementOffset					ENUMERATED {offset01, offset10, offset11 }			OPTIONAL,	-- Need S
+			-- UL PTRS power boosting factor per PTRS port. Corresponds to L1 parameter 'UL-PTRS-power' (see 38.214, section 6.1, table 6.2.3-5)
+			ptrs-Power								ENUMERATED {p00, p01, p10, p11}
+		},
+		-- Configuration of UL PTRS for DFT-S-OFDM. 
+		dft-S-OFDM								SEQUENCE {
+			-- Sample density of PT-RS for DFT-s-OFDM, pre-DFT, indicating a set of thresholds T={NRBn,n=0,1,2,3,4},
+			-- that indicates dependency between presence of PT-RS and scheduled BW and the values of X and K the UE should 
+			-- use depending on the scheduled BW according to the table in 38.214 FFS_Section. 
+			-- Corresponds to L1 parameter 'UL-PTRS-pre-DFT-density' (see 38.214, section 6.1, 6.2.3-3)
+			sampleDensity						SEQUENCE (SIZE (5)) OF INTEGER (1..276),
+			-- Time density (OFDM symbol level) of PT-RS for DFT-s-OFDM. If the value is absent, the UE applies value d1.
+			-- Corresponds to L1 parameter 'UL-PTRS-time-density-transform-precoding' (see 38.214, section 6.1)
+			timeDensity							ENUMERATED {d2}														OPTIONAL	-- Need S
+		}
+	}																													OPTIONAL,	-- Cond M
+	...
+}
+
+-- TAG-PTRS-UPLINKCONFIG-STOP
+-- TAG-PUCCH-CONFIG-START
+
+PUCCH-Config ::= 						SEQUENCE {
+	-- Lists for adding and releasing PUCCH resource sets (see 38.213, section 9.2)
+	resourceSetToAddModList					SEQUENCE (SIZE (1..maxNrofPUCCH-ResourceSets)) OF PUCCH-ResourceSet				OPTIONAL,	-- Need N
+	resourceSetToReleaseList				SEQUENCE (SIZE (1..maxNrofPUCCH-ResourceSets)) OF PUCCH-ResourceSetId			OPTIONAL,	-- Need N
+
+	-- Lists for adding and releasing PUCCH resources applicable for the UL BWP and serving cell in which the PUCCH-Config 
+	-- is defined. The resources defined herein are referred to from other parts of the configuration to determine which 
+	-- resource the UE shall use for which report. 
+	resourceToAddModList					SEQUENCE (SIZE (1..maxNrofPUCCH-Resources)) OF PUCCH-Resource				OPTIONAL,	-- Need N
+	resourceToReleaseList					SEQUENCE (SIZE (1..maxNrofPUCCH-Resources)) OF PUCCH-ResourceId				OPTIONAL,	-- Need N
+
+	-- Parameters that are common for all PUCCH resources of format 1
+	format1									SetupRelease { PUCCH-FormatConfig }												OPTIONAL,	-- Need M
+	-- Parameters that are common for all PUCCH resources of format 2
+	format2									SetupRelease { PUCCH-FormatConfig }												OPTIONAL,	-- Need M
+	-- Parameters that are common for all PUCCH resources of format 3
+	format3									SetupRelease { PUCCH-FormatConfig }												OPTIONAL,	-- Need M
+	-- Parameters that are common for all PUCCH resources of format 4
+	format4									SetupRelease { PUCCH-FormatConfig }												OPTIONAL,	-- Need M
+
+	schedulingRequestResourceToAddModList	SEQUENCE (SIZE (1..maxNrofSR-Resources)) OF SchedulingRequestResourceConfig		OPTIONAL, -- Need M
+	schedulingRequestResourceToReleaseList	SEQUENCE (SIZE (1..maxNrofSR-Resources)) OF SchedulingRequestResourceId			OPTIONAL, -- Need M
+
+	multi-CSI-PUCCH-ResourceList			SEQUENCE (SIZE (1..2)) OF PUCCH-ResourceId										OPTIONAL,-- Need M
+
+	-- List of timiing for given PDSCH to the DL ACK. In this version of the specification only the values [0..8] are applicable.
+	-- Corresponds to L1 parameter 'Slot-timing-value-K1' (see 38.213, section FFS_Section)
+	dl-DataToUL-ACK							SEQUENCE (SIZE (8)) OF INTEGER (0..15)											OPTIONAL,	-- Need M
+
+	-- Configuration of the spatial relation between a reference RS and PUCCH. Reference RS can be SSB/CSI-RS/SRS.
+	-- If the list has more than one element, MAC-CE selects a single element (see 38.321, section FFS_Section).
+	-- Corresponds to L1 parameter 'PUCCH-SpatialRelationInfo' (see 38.213, section FFS_Section)
+	spatialRelationInfoToAddModList			SEQUENCE (SIZE (1..maxNrofSpatialRelationInfos)) OF PUCCH-SpatialRelationInfo	OPTIONAL,	-- Need N
+	spatialRelationInfoToReleaseList		SEQUENCE (SIZE (1..maxNrofSpatialRelationInfos)) OF PUCCH-SpatialRelationInfoId	OPTIONAL,	-- Need N
+
+	pucch-PowerControl						PUCCH-PowerControl																OPTIONAL,	-- Need M
+	...
+}
+
+PUCCH-FormatConfig ::=					SEQUENCE {
+	-- Enabling inter-slot frequency hopping when PUCCH Format 1, 3 or 4 is repetead over multiple slots.
+	-- The field is not applicable for format 2.
+	interslotFrequencyHopping				ENUMERATED {enabled}														OPTIONAL, 	-- Need R
+	-- Enabling 2 DMRS symbols per hop of a PUCCH Format 3 or 4 if both hops are more than X symbols when FH is enabled (X=4).
+	-- Enabling 4 DMRS sybmols for a PUCCH Format 3 or 4 with more than 2X+1 symbols when FH is disabled (X=4).
+	-- Corresponds to L1 parameter 'PUCCH-F3-F4-additional-DMRS' (see 38.213, section 9.2.1)
+	-- The field is not applicable for format 1 and 2.
+	additionalDMRS							ENUMERATED {true}															OPTIONAL,	-- Need R
+	-- Max coding rate to determine how to feedback UCI on PUCCH for format 2, 3 or 4
+	-- Corresponds to L1 parameter 'PUCCH-F2-maximum-coderate', 'PUCCH-F3-maximum-coderate' and 'PUCCH-F4-maximum-coderate' 
+	-- (see 38.213, section 9.2.5)
+	-- The field is not applicable for format 1.
+	maxCodeRate								PUCCH-MaxCodeRate															OPTIONAL,	-- Need R
+	-- Number of slots with the same PUCCH F1, F3 or F4. When the field is absent the UE applies the value n1.
+	-- Corresponds to L1 parameter 'PUCCH-F1-number-of-slots', 'PUCCH-F3-number-of-slots' and 'PUCCH-F4-number-of-slots'
+	-- (see 38.213, section 9.2.6)
+	-- The field is not applicable for format 2.
+	nrofSlots								ENUMERATED {n2,n4,n8}													OPTIONAL, 	-- Need S
+	-- Enabling pi/2 BPSK for UCI symbols instead of QPSK for PUCCH. 
+	-- Corresponds to L1 parameter 'PUCCH-PF3-PF4-pi/2PBSK' (see 38.213, section 9.2.5)
+	-- The field is not applicable for format 1 and 2.
+	pi2PBSK									ENUMERATED {enabled}														OPTIONAL, 	-- Need R
+	-- Enabling simultaneous transmission of CSI and HARQ-ACK feedback with or without SR with PUCCH Format 2, 3 or 4
+	-- Corresponds to L1 parameter 'PUCCH-F2-Simultaneous-HARQ-ACK-CSI', 'PUCCH-F3-Simultaneous-HARQ-ACK-CSI' and
+	-- 'PUCCH-F4-Simultaneous-HARQ-ACK-CSI' (see 38.213, section 9.2.5)
+	-- When the field is absent the UE applies the value OFF
+	-- The field is not applicable for format 1.
+	simultaneousHARQ-ACK-CSI				ENUMERATED {true}															OPTIONAL	-- Need R
+}
+
+PUCCH-MaxCodeRate ::= 						ENUMERATED {zeroDot08, zeroDot15, zeroDot25, zeroDot35, zeroDot45, zeroDot60, zeroDot80}
+
+PUCCH-SpatialRelationInfo ::=				SEQUENCE {
+	pucch-SpatialRelationInfoId					PUCCH-SpatialRelationInfoId,
+	referenceSignal 							CHOICE {
+		ssb-Index									SSB-Index,
+		csi-RS-Index								NZP-CSI-RS-ResourceId,
+		srs											SRS-ResourceId
+	},
+	pucch-PathlossReferenceRS-Id 				PUCCH-PathlossReferenceRS-Id,
+	p0-PUCCH-Id									P0-PUCCH-Id,
+	closedLoopIndex								ENUMERATED { i0, i1 }
+}
+
+PUCCH-SpatialRelationInfoId ::= 			INTEGER (1..maxNrofSpatialRelationInfos)
+
+-- A set with one or more PUCCH resources
+PUCCH-ResourceSet ::=							SEQUENCE {
+	pucch-ResourceSetId								PUCCH-ResourceSetId,
+
+	-- PUCCH resources of format0 and format1 are only allowed in the first PUCCH reosurce set,
+	-- i.e., in a PUCCH-ResourceSet with pucch-ResourceSetId = 0. This set may contain between 8 and 32 resources. 
+	-- PUCCH resources of format2, format3 and format4 are only allowed  in a PUCCH-ReosurceSet with pucch-ResourceSetId > 0. If present, these sets must contain 8 resources each.
+	-- The UE chooses a PUCCH-Resource from this list based on the 3-bit PUCCH resource indicator field in DCI as 
+	-- speciied in 38.213, FFS_section.
+	-- Note that this list contains only a list of resource IDs. The actual resources are configured in PUCCH-Config.
+	resources										SEQUENCE (SIZE (8..maxNrofPUCCH-ResourcesPerSet)) OF PUCCH-ResourceId,
+
+	-- Maximum number of payload bits minus 1 that the UE may transmit using this PUCCH resource set. In a PUCCH occurrence, the UE 
+	-- chooses the first of its PUCCH-ResourceSet which supports the number of bits that the UE wants to transmit. 
+	-- The field is not present in the first set (Set0) since the maximum Size of Set0 is specified to be 3 bit.
+	-- The field is not present in the last configured set since the UE derives its maximum payload size as specified in 38.213.
+	-- This field can take integer values that are multiples of 4. Corresponds to L1 parameter 'N_2' or 'N_3' (see 38.213, section 9.2)
+	maxPayloadMinus1								INTEGER (4..256)														OPTIONAL	-- Need R
+}
+
+PUCCH-ResourceSetId ::=							INTEGER (0..maxNrofPUCCH-ResourceSets-1)
+
+PUCCH-Resource ::= 								SEQUENCE {
+	pucch-ResourceId								PUCCH-ResourceId,
+
+	startingPRB										PRB-Id, 
+	-- Corresponds to the L1 parameter 'PUCCH-frequency-hopping' (see 38.213, section 9.2)
+	intraSlotFrequencyHopping						ENUMERATED { enabled }													OPTIONAL,	-- Need R
+	-- Index of starting PRB for second hop of PUCCH in case of FH. This value is appliable for intra-slot frequency hopping.
+	-- Corresponds to L1 parameter 'PUCCH-2nd-hop-PRB' (see 38.213, section 9.2)
+	secondHopPRB									PRB-Id																	OPTIONAL,	-- Need R
+
+	-- Selection of the PUCCH format and format-specific parameters
+	format											CHOICE {
+		format0											PUCCH-format0,														-- Cond InFirstSetOnly
+		format1											PUCCH-format1,														-- Cond InFirstSetOnly
+		format2											PUCCH-format2,														-- Cond NotInFirstSet
+		format3											PUCCH-format3,														-- Cond NotInFirstSet
+		format4											PUCCH-format4														-- Cond NotInFirstSet
+	}
+}
+
+PUCCH-ResourceId ::=							INTEGER (0..maxNrofPUCCH-Resources-1)
+
+
+-- A PUCCH Format 0 resource configuration (see 38.213, section 9.2)
+-- Corresponds to L1 parameter 'PUCCH-format0' (see 38.213, section 9.2.1)
+PUCCH-format0 ::=								SEQUENCE {
+	initialCyclicShift								INTEGER(0..11),
+	nrofSymbols										INTEGER (1..2), 
+	startingSymbolIndex								INTEGER(0..13) 
+}
+
+-- A PUCCH Format 1 resource configuration (see 38.213, section 9.2)
+-- Corresponds to L1 parameter 'PUCCH-format1' (see 38.213, section 9.2.1)
+PUCCH-format1 ::= 								SEQUENCE {
+	initialCyclicShift								INTEGER(0..11), 
+	nrofSymbols										INTEGER (4..14), 
+	startingSymbolIndex								INTEGER(0..10), 
+	timeDomainOCC									INTEGER(0..6)
+}
+
+-- A PUCCH Format 2 resource configuration (see 38.213, section 9.2)
+-- Corresponds to L1 parameter 'PUCCH-format2onfig' (see 38.213, section 9.2.1)
+PUCCH-format2 ::= 								SEQUENCE {
+	nrofPRBs										INTEGER (1..16), 
+	nrofSymbols										INTEGER (1..2), 
+	startingSymbolIndex								INTEGER(0..13) 
+}
+
+-- A PUCCH Format 3 resource configuration(see 38.213, section 9.2)
+-- Corresponds to L1 parameter 'PUCCH-format3' (see 38.213, section 9.2.1)
+PUCCH-format3 ::= 								SEQUENCE {
+	-- The supported values are 1,2,3,4,5,6,8,9,10,12,15 and 16
+	nrofPRBs										INTEGER (1..16), 
+	nrofSymbols										INTEGER (4..14), 
+	startingSymbolIndex								INTEGER(0..10) 
+}
+
+-- A PUCCH Format 4 resource configuration (see 38.213, section 9.2)
+-- Corresponds to L1 parameter 'PUCCH-format4' (see 38.213, section 9.2.1)
+PUCCH-format4 ::= 								SEQUENCE {
+	nrofSymbols										INTEGER (4..14), 
+	occ-Length										ENUMERATED {n2,n4}, 
+	occ-Index										ENUMERATED {n0,n1,n2,n3},
+	startingSymbolIndex								INTEGER(0..10) 
+}
+
+-- TAG-PUCCH-CONFIG-STOP 
+-- TAG-PUCCH-CONFIGCOMMON-START
+
+PUCCH-ConfigCommon ::=					SEQUENCE {
+	-- An entry into a 16-row table where each row configures a set of cell-specific PUCCH resources/parameters. The UE uses 
+	-- those PUCCH resources during initial access on the initial uplink BWP. Once the network provides a dedicated PUCCH-Config 
+	-- for that bandwidth part the UE applies that one instead of the one provided in this field.   
+	-- Corresponds to L1 parameter 'PUCCH-resource-common' (see 38.213, section 9.2)
+	pucch-ResourceCommon					BIT STRING (SIZE (4))															OPTIONAL,	-- Need R
+
+	-- Configuration of group- and sequence hopping for all the PUCCH formats 0, 1, 3 and 4. "neither" implies neither group 
+	-- or sequence hopping is enabled. "enable" enables group hopping and disables sequence hopping. "disable"” disables group 
+	-- hopping and enables sequence hopping. Corresponds to L1 parameter 'PUCCH-GroupHopping' (see 38.211, section 6.4.1.3)
+	pucch-GroupHopping						ENUMERATED { neither, enable, disable },
+	-- Cell-Specific scrambling ID for group hoppping and sequence hopping if enabled.
+	-- Corresponds to L1 parameter 'HoppingID' (see 38.211, section 6.3.2.2)
+	hoppingId								BIT STRING (SIZE (10))															OPTIONAL, 	-- Need R
+
+	-- Power control parameter P0 for PUCCH transmissions. Value in dBm. Only even values (step size 2) allowed. 
+	-- Corresponds to L1 parameter 'p0-nominal-pucch' (see 38.213, section 7.2)
+	p0-nominal								INTEGER (-202..24)																OPTIONAL, 	-- Need R
+
+	...
+}
+
+-- TAG-PUCCH-CONFIGCOMMON-STOP
+-- TAG-PUCCH-POWERCONTROL-START
+PUCCH-PowerControl ::= 				SEQUENCE {
+
+	-- deltaF for PUCCH format 0 with 1dB step size (see 38.213, section 7.2)
+	deltaF-PUCCH-f0							INTEGER (-16..15)																	OPTIONAL, 	-- Need R
+	-- deltaF for PUCCH format 1 with 1dB step size (see 38.213, section 7.2)
+	deltaF-PUCCH-f1							INTEGER (-16..15)																	OPTIONAL, 	-- Need R
+	-- deltaF for PUCCH format 2 with 1dB step size (see 38.213, section 7.2)
+	deltaF-PUCCH-f2							INTEGER (-16..15)																	OPTIONAL, 	-- Need R
+	-- deltaF for PUCCH format 3 with 1dB step size (see 38.213, section 7.2)
+	deltaF-PUCCH-f3							INTEGER (-16..15)																	OPTIONAL, 	-- Need R
+	-- deltaF for PUCCH format 4 with 1dB step size (see 38.213, section 7.2)
+	deltaF-PUCCH-f4							INTEGER (-16..15)																	OPTIONAL, 	-- Need R
+
+	-- A set with dedicated P0 values for PUCCH, i.e.,  {P01, P02,... }. Corresponds to L1 parameter 'p0-pucch-set' (see 38.213, section 7.2)
+	p0-Set								SEQUENCE (SIZE (1..maxNrofPUCCH-P0-PerSet)) OF P0-PUCCH									OPTIONAL, -- Need M
+
+	-- A set of Reference Signals (e.g. a CSI-RS config or a SSblock) to be used for PUCCH pathloss estimation. 
+	-- Up to maxNrofPUCCH-PathlossReference-RSs may be configured
+	-- FFS_CHECK: Is it possible not to configure it at all? What does the UE use then? Any SSB?
+	-- Corresponds to L1 parameter 'pucch-pathlossReference-rs-config' (see 38.213, section 7.2)
+	pathlossReferenceRSs				SEQUENCE (SIZE (1..maxNrofPUCCH-PathlossReferenceRSs)) OF PUCCH-PathlossReferenceRS	OPTIONAL, -- Need M
+	-- Number of PUCCH power control adjustment states maintained by the UE (i.e., g(i)). If the field is present (n2) the UE maintains
+	-- two power control states (i.e., g(i,0) and g(i,1)). Otherwise, it applies one (i.e., g(i,0)). 
+	-- Corresponds to L1 parameter 'num-pucch-pcadjustment-states' (see 38.213, section 7.2)
+	twoPUCCH-PC-AdjustmentStates		ENUMERATED {twoStates}																	OPTIONAL, -- Need R
+	...
+}
+
+-- P0 value for PUCCH. Corresponds to L1 parameter 'p0-pucch' (see 3,213, section 7.2)
+P0-PUCCH ::=							SEQUENCE {
+	p0-PUCCH-Id								P0-PUCCH-Id,
+	-- P0 value for PUCCH with 1dB step size.
+	p0-PUCCH-Value							INTEGER (-16..15)
+}
+
+P0-PUCCH-Id ::=							INTEGER (1..8)
+
+-- A reference signal (RS) configured as pathloss reference signal for PUCCH power control
+-- Corresponds to L1 parameter 'pucch-pathlossReference-rs' (see 38.213, section 7.2)
+PUCCH-PathlossReferenceRS ::=					SEQUENCE {
+	pucch-PathlossReferenceRS-Id 				PUCCH-PathlossReferenceRS-Id, 
+	referenceSignal								CHOICE {
+		ssb-Index									SSB-Index,
+		csi-RS-Index								NZP-CSI-RS-ResourceId
+	}
+}
+
+-- ID for a referemce signal (RS) configured as PUCCH pathloss reference 
+-- Corresponds to L1 parameter 'pucch-pathlossreference-index' (see 38.213, section 7.2)
+-- FFS_CHECK: Is this ID used anywhere except inside the PUCCH-PathlossReference-RS	itself? If not, remove.
+PUCCH-PathlossReferenceRS-Id ::=			INTEGER (0..maxNrofPUCCH-PathlossReferenceRSs-1)
+
+-- TAG-PUCCH-POWERCONTROL-STOP
+-- TAG-PUCCH-TPC-COMMANDCONFIG-START
+
+PUCCH-TPC-CommandConfig ::=				SEQUENCE {
+	-- An index determining the position of the first bit of TPC command (applicable to the SpCell) inside the DCI format 2-2 payload. 
+	tpc-IndexPCell							INTEGER (1..15)													OPTIONAL,	-- Cond PUCCH-SCell
+	-- An index determining the position of the first bit of TPC command (applicable to the PUCCH-SCell) inside the DCI format 2-2 payload. 
+	tpc-IndexPUCCH-SCell					INTEGER (1..15)													OPTIONAL,	-- Cond PUCCH-SCellOnly
+    ...
+}
+
+-- TAG-PUCCH-TPC-COMMANDCONFIG-STOP
+-- TAG-PUSCH-CONFIG-START
+
+PUSCH-Config ::= 						SEQUENCE {
+	-- Identifer used to initalite data scrambling (c_init) for both PUSCH.
+	-- Corresponds to L1 parameter 'Data-scrambling-Identity' (see 38,214, section FFS_Section)
+	dataScramblingIdentityPUSCH			INTEGER (0..1007)															OPTIONAL,	-- Need M
+	-- Whether UE uses codebook based or non-codebook based transmission. Corresponds to L1 parameter 'ulTxConfig' (see 38.214, section 6.1.1)
+	txConfig								ENUMERATED {codebook, nonCodebook},
+
+	-- DMRS configuration for PUSCH transmissions using PUSCH mapping type A (chosen dynamically via PUSCH-TimeDomainResourceAllocation).
+	dmrs-UplinkForPUSCH-MappingTypeA		SetupRelease { DMRS-UplinkConfig }											OPTIONAL,	-- Need M
+	-- DMRS configuration for PUSCH transmissions using PUSCH mapping type B (chosen dynamically via PUSCH-TimeDomainResourceAllocation)
+	dmrs-UplinkForPUSCH-MappingTypeB		SetupRelease { DMRS-UplinkConfig }									OPTIONAL,	-- Need M
+
+	pusch-PowerControl						PUSCH-PowerControl															OPTIONAL, -- Need M
+	-- Configured one of two supported frequency hopping mode. If not configured frequency hopping is not configured
+	-- Corresponds to L1 parameter 'Frequency-hopping-PUSCH' (see 38.214, section 6)
+	-- When the field is absent the UE applies the value Not configured
+	frequencyHopping						ENUMERATED {mode1, mode2}													OPTIONAL,	-- Need S
+	-- Set of frequency hopping offsets used when frequency hopping is enabled for granted transmission (not msg3) and type 2
+	-- Corresponds to L1 parameter 'Frequency-hopping-offsets-set' (see 38.214, section 6.3)
+	frequencyHoppingOffsetLists				SEQUENCE (SIZE (1..4)) OF INTEGER (1.. maxNrofPhysicalResourceBlocks-1)	OPTIONAL,	-- Need M
+	-- Configuration of resource allocation type 0 and resource allocation type 1 for non-fallback DCI
+	-- Corresponds to L1 parameter 'Resouce-allocation-config' (see 38.214, section 6.1.2)
+	resourceAllocation						ENUMERATED { resourceAllocationType0, resourceAllocationType1, dynamicSwitch},
+
+	-- List of time domain allocations for timing of UL assignment to UL data. If configured, the values provided herein 
+	-- override the values received in corresponding PUSCH-ConfigCommon.
+	pusch-AllocationList					SEQUENCE (SIZE(1..maxNrofUL-Allocations)) OF PUSCH-TimeDomainResourceAllocation	OPTIONAL, 	-- Need R,
+	-- Number of repetitions for data. Corresponds to L1 parameter 'aggregation-factor-UL' (see 38.214, section FFS_Section)
+	-- When the field is absent the UE applies the value 1.
+	pusch-AggregationFactor					ENUMERATED { n2, n4, n8 }													OPTIONAL, 	-- Need S
+
+	-- Indicates which MCS table the UE shall use for PUSCH without transform precoder
+	-- Corresponds to L1 parameter 'MCS-Table-PUSCH' (see 38.214, section 6.1.4)
+	-- When the field is absent the UE applies the value 64QAM
+	mcs-Table								ENUMERATED {qam256}													OPTIONAL,	-- Need S
+	-- Indicates which MCS table the UE shall use for PUSCH with transform precoding
+	-- Corresponds to L1 parameter 'MCS-Table-PUSCH-transform-precoding' (see 38.214, section 6.1.4)
+	-- When the field is absent the UE applies the value 64QAM
+	mcs-TableTransformPrecoder				ENUMERATED { qam256}													OPTIONAL,	-- Need S
+	-- The UE specific selection of transformer precoder for PUSCH. When the field is absent the UE applies the value msg3-tp.
+	-- Corresponds to L1 parameter 'PUSCH-tp' (see 38.211, section 6.3.1.4)
+	transformPrecoder						ENUMERATED {enabled, disabled}												OPTIONAL,	-- Need S
+	-- Subset of PMIs addressed by TPMI, where PMIs are those supported by UEs with maximum coherence capabilities 
+	-- Corresponds to L1 parameter 'ULCodebookSubset' (see 38.211, section 6.3.1.5)
+	codebookSubset			ENUMERATED {fullyAndPartialAndNonCoherent, partialAndNonCoherent, nonCoherent},
+	-- Subset of PMIs addressed by TRIs from 1 to ULmaxRank. Corresponds to L1 parameter 'ULmaxRank' (see 38.211, section 6.3.1.5)
+	maxRank									INTEGER (1..4),
+
+	-- Selection between config 1 and config 2 for RBG size for PUSCH. When the field is absent the UE applies the value config1.
+	-- Corresponds to L1 parameter 'RBG-size-PUSCH' (see 38.214, section 6.1.2.2.1)
+	rbg-Size								ENUMERATED { config2}												OPTIONAL,	-- Need S
+
+	-- Selection between and configuration of dynamic and semi-static beta-offset.
+	-- If the field is absent or released, the UE applies the value 'semiStatic' and the BetaOffsets according to 
+	-- FFS [BetaOffsets and/or section 9.x.x).
+	-- Corresponds to L1 parameter 'UCI-on-PUSCH' (see 38.213, section 9.3)
+	uci-OnPUSCH							SetupRelease { UCI-OnPUSCH}									OPTIONAL, -- Need M
+	-- Interleaving unit configurable between 2 and 4 PRBs
+	-- Corresponds to L1 parameter 'VRB-to-PRB-interleaver' (see 38.211, section 6.3.1.6)
+	vrb-ToPRB-Interleaver					ENUMERATED {n2, n4},
+	...
+}
+
+UCI-OnPUSCH ::= 						SEQUENCE {
+	betaOffsets								CHOICE {
+			dynamic									SEQUENCE (SIZE (4)) OF BetaOffsets,
+			semiStatic								BetaOffsets
+	}																													OPTIONAL, -- Need M
+	-- Indicates a scaling factor to limit the number of resource elements assigned to UCI on PUSCH.
+	-- Value f0p5 corresponds to 0.5, value f0p65 corresponds to 0.65, and so on. 
+	-- Corresponds to L1 parameter 'uci-on-pusch-scaling' (see 38.212, section 6.3)
+	scaling						ENUMERATED { f0p5, f0p65, f0p8, f1 }
+}
+
+-- TAG-PUSCH-CONFIG-STOP
+-- TAG-PUSCH-CONFIGCOMMON-START
+
+PUSCH-ConfigCommon ::= 					SEQUENCE {
+	-- Sequence-group hopping can be enabled or disabled by means of this cell-specific parameter. 
+	-- Corresponds to L1 parameter 'Group-hopping-enabled-Transform-precoding' (see 38.211, section FFS_Section)
+	-- This field is Cell specific
+	groupHoppingEnabledTransformPrecoding	ENUMERATED {enabled}															OPTIONAL,	-- Need R
+
+	-- List of time domain allocations for timing of UL assignment to UL data
+	pusch-AllocationList					SEQUENCE (SIZE(1..maxNrofUL-Allocations)) OF PUSCH-TimeDomainResourceAllocation	OPTIONAL,	-- Need R
+
+	-- ------------------------
+	-- Power control parameters
+
+	-- Power offset between msg3 and RACH preamble transmission in steps of 1dB. 
+	-- Corresponds to L1 parameter 'Delta-preamble-msg3' (see 38.213, section 7.1)
+	msg3-DeltaPreamble							INTEGER (-1..6)															OPTIONAL,	-- Need R
+
+	-- P0 value for PUSCH with grant (except msg3). Value in dBm. Only even values (step size 2) allowed.
+	-- Corresponds to L1 parameter 'p0-nominal-pusch-withgrant' (see 38.213, section 7.1)
+	-- This field is cell specific
+	p0-NominalWithGrant						INTEGER (-202..24)																OPTIONAL,	-- Need R
+	...
+}
+
+-- TAG-PUSCH-CONFIGCOMMON-STOP
+-- TAG-PUSCH-POWERCONTROL-START
+
+PUSCH-PowerControl ::= 						SEQUENCE {
+
+	-- If enabled, UE applies TPC commands via accumulation. If not enabled, UE applies the TPC command without accumulation. 
+	-- If absent, TPC accumulation is enabled. Corresponds to L1 parameter 'Accumulation-enabled' (see 38.213, section 7.1)
+	tpc-Accumulation							ENUMERATED { disabled }													OPTIONAL,	-- Need R
+
+	-- Dedicated alpha value for msg3 PUSCH. Corresponds to L1 parameter 'alpha-ue-pusch-msg3' (see 38.213, section 7.1)
+	-- When the field is absent the UE applies the value 1.
+	msg3-Alpha									Alpha																	OPTIONAL, 	-- Need S
+
+	-- P0 value for UL grant-free/SPS based PUSCH. Value in dBm. Only even values (step size 2) allowed.
+	-- Corresponds to L1 parameter 'p0-nominal-pusch-withoutgrant' (see 38.213, section 7.1)
+	p0-NominalWithoutGrant						INTEGER (-202..24)														OPTIONAL,	-- Need M,
+	-- configuration {p0-pusch,alpha} sets for PUSCH (except msg3), i.e., { {p0,alpha,index1}, {p0,alpha,index2},...}.
+	-- Corresponds to L1 parameter 'p0-push-alpha-setconfig' (see 38,213, section 7.1)
+	p0-AlphaSets								SEQUENCE (SIZE (1..maxNrofP0-PUSCH-AlphaSets)) OF P0-PUSCH-AlphaSet		OPTIONAL,	-- Need M,
+
+	-- A set of Reference Signals (e.g. a CSI-RS config or a SSblock) to be used for PUSCH path loss estimation. 
+	-- Up to maxNrofPUSCH-PathlossReferenceRSs may be configured when 'PUSCH beam indication' is present (FFS: in DCI???). 
+	-- Otherwise, there may be only one entry. 
+	-- Corresponds to L1 parameter 'pusch-pathlossReference-rs-config' (see 38.213, section 7.1)
+	pathlossReferenceRSToAddModList				SEQUENCE (SIZE (1..maxNrofPUSCH-PathlossReferenceRSs)) OF PUSCH-PathlossReferenceRS	
+																														OPTIONAL,	-- Need N
+	pathlossReferenceRSToReleaseList			SEQUENCE (SIZE (1..maxNrofPUSCH-PathlossReferenceRSs)) OF PUSCH-PathlossReferenceRS-Id	
+																														OPTIONAL,	-- Need N
+
+	-- Number of PUSCH power control adjustment states maintained by the UE (i.e., fc(i)). If the field is present (n2) the UE maintains
+	-- two power control states (i.e., fc(i,1) and fc(i,2)). Otherwise, it applies one (i.e., fc(i,1)). 
+	-- Corresponds to L1 parameter 'num-pusch-pcadjustment-states' (see 38.213, section 7.1)
+	twoPUSCH-PC-AdjustmentStates				ENUMERATED {twoStates}													OPTIONAL, -- Need S
+
+	-- Indicates whether to apply dela MCS. When the field is absent, the UE applies Ks = 0 in delta_TFC formula for PUSCH. 
+	-- Corresponds to L1 parameter 'deltaMCS-Enabled' (see 38.213, section 7.1)
+	deltaMCS									ENUMERATED {enabled}													OPTIONAL, -- Need S
+
+	-- A list of SRI-PUSCH-PowerControl elements among which one is selected by the SRI field in DCI. 
+	-- Corresponds to L1 parameter 'SRI-PUSCHPowerControl-mapping' (see 38.213, section 7.1)
+	sri-PUSCH-MappingToAddModList			SEQUENCE (SIZE (1..maxNrofSRI-PUSCH-Mappings)) OF SRI-PUSCH-PowerControl		OPTIONAL, -- Need M
+	sri-PUSCH-MappingToReleaseList				SEQUENCE (SIZE (1..maxNrofSRI-PUSCH-Mappings)) OF SRI-PUSCH-PowerControlId	OPTIONAL -- Need M 
+}
+
+-- A set of p0-pusch and alpha used for PUSCH with grant. 'PUSCH beam indication' (if present) gives the index of the set to 
+-- be used for a particular PUSCH transmission.
+-- FFS_CHECK: Is the ”PUSCH beam indication” in DCI which schedules the PUSCH? If so, clarify in field description
+-- Corresponds to L1 parameter 'p0-pusch-alpha-set' (see 38.213, section 7.1)
+P0-PUSCH-AlphaSet ::= 						SEQUENCE {
+	p0-PUSCH-AlphaSetId 						P0-PUSCH-AlphaSetId,
+	-- P0 value for PUSCH with grant (except msg3) in steps of 1dB. Corresponds to L1 parameter 'p0-pusch' (see 38,213, section 7.1)
+	p0											INTEGER (-16..15)															OPTIONAL,
+	-- alpha value for PUSCH with grant (except msg3) (see 38.213, section 7.1)
+	-- When the field is absent the UE applies the value 1
+	alpha 										Alpha																	OPTIONAL	-- Need S
+}
+
+-- ID for a P0-PUSCH-AlphaSet. Corresponds to L1 parameter 'p0alphasetindex' (see 38.213, section 7.1)
+P0-PUSCH-AlphaSetId ::= 					INTEGER (0..maxNrofP0-PUSCH-AlphaSets-1)
+
+-- A reference signal (RS) configured as pathloss reference signal for PUSCH power control
+-- Corresponds to L1 parameter 'pusch-pathlossReference-rs' (see 38.213, section 7.1)
+PUSCH-PathlossReferenceRS ::=				SEQUENCE {
+	pusch-PathlossReferenceRS-Id 				PUSCH-PathlossReferenceRS-Id, 
+	referenceSignal								CHOICE {
+		ssb-Index									SSB-Index,
+		csi-RS-Index									NZP-CSI-RS-ResourceId
+	}
+}
+
+-- ID for a referemce signal (RS) configured as PUSCH pathloss reference 
+-- Corresponds to L1 parameter 'pathlossreference-index' (see 38.213, section 7.1)
+-- FFS_CHECK: Is this ID used anywhere except inside the PUSCH-PathlossReference-RS	itself?
+PUSCH-PathlossReferenceRS-Id ::=			INTEGER (0..maxNrofPUSCH-PathlossReferenceRSs-1)
+
+
+-- A set of PUSCH power control parameters associated with one SRS-ResourceIndex (SRI)
+SRI-PUSCH-PowerControl ::=					SEQUENCE {
+	-- The ID of this SRI-PUSCH-PowerControl configuration. It is used as the codepoint (payload) in the SRI DCI field.
+	sri-PUSCH-PowerControlId					SRI-PUSCH-PowerControlId,
+	-- The ID of PUSCH-PathlossReferenceRS as configured in the pathlossReferenceRSToAddModList in PUSCH-PowerControl.
+	sri-PUSCH-PathlossReferenceRS-Id 			PUSCH-PathlossReferenceRS-Id,
+	-- The ID of a P0-PUSCH-AlphaSet as configured in p0-AlphaSets in PUSCH-PowerControl.
+	sri-P0-PUSCH-AlphaSetId 					P0-PUSCH-AlphaSetId,
+	-- The index of the closed power control loop associated with this SRI-PUSCH-PowerControl
+	sri-PUSCH-ClosedLoopIndex					ENUMERATED { i0, i1 }
+}
+
+SRI-PUSCH-PowerControlId ::=				INTEGER (0..maxNrofSRI-PUSCH-Mappings-1)
+
+-- A set of beta-offset values
+BetaOffsets ::= 							SEQUENCE {
+	-- Up to 2 bits HARQ-ACK. Corresponds to L1 parameter 'betaOffset-ACK-Index-1' (see 38.213, section 9.3)
+	-- When the field is absent the UE applies the value 11
+	betaOffsetACK-Index1						INTEGER(0..31)															OPTIONAL, -- Need S
+	-- Up to 11 bits HARQ-ACK. Corresponds to L1 parameter 'betaOffset-ACK-Index-2' (see 38.213, section 9.3)
+	-- When the field is absent the UE applies the value 11
+	betaOffsetACK-Index2						INTEGER(0..31)															OPTIONAL, -- Need S
+	-- Above 11 bits HARQ-ACK. Corresponds to L1 parameter 'betaOffset-ACK-Index-3' (see 38.213, section 9.3)
+	-- When the field is absent the UE applies the value 11
+	betaOffsetACK-Index3						INTEGER(0..31)															OPTIONAL, -- Need S
+	-- Up to 11 bits of CSI part 1 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-1-Index-1' (see 38.213, section 9.3)
+	-- When the field is absent the UE applies the value 13
+	betaOffsetCSI-Part1-Index1						INTEGER(0..31)															OPTIONAL, -- Need S
+	-- Above 11 bits of CSI part 1 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-1-Index-2' (see 38.213, section 9.3)
+	-- When the field is absent the UE applies the value 13
+	betaOffsetCSI-Part1-Index2						INTEGER(0..31)															OPTIONAL, -- Need S
+	-- Up to 11 bits of CSI part 2 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-2-Index-1' (see 38.213, section 9.3)
+	-- When the field is absent the UE applies the value 13
+	betaOffsetCSI-Part2-Index1						INTEGER(0..31)															OPTIONAL, -- Need S
+	-- Above 11 bits of CSI part 2 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-2-Index-2' (see 38.213, section 9.3)
+	-- When the field is absent the UE applies the value 13
+	betaOffsetCSI-Part2-Index2						INTEGER(0..31)															OPTIONAL -- Need S
+}
+
+-- TAG-PUSCH-POWERCONTROL-STOP
+-- TAG-PUSCH-SERVINGCELLCONFIG-START
+
+PUSCH-ServingCellConfig ::=				SEQUENCE {
+	-- Enables and configures code-block-group (CBG) based transmission (see 38.214, section FFS_Section)
+	codeBlockGroupTransmission				SetupRelease { PUSCH-CodeBlockGroupGransmission	}							OPTIONAL,	-- Need M
+	-- Enables LBRM (Limited buffer rate-matching). When the field is absent the UE applies FBRM (Full buffer rate-matchingLBRM).
+	-- Corresponds to L1 parameter 'LBRM-FBRM-selection' (see 38.212, section 5.4.2)
+	rateMatching							ENUMERATED {limitedBufferRM}												OPTIONAL,	-- Need S
+	-- Accounts for overhead from CSI-RS, CORESET, etc. If the field is absent, the UE applies the value 'xoh0'.
+	-- Corresponds to L1 parameter 'Xoh-PUSCH' (see 38.214, section 5.1.3.2)
+	xOverhead								ENUMERATED {xoh6, xoh12, xoh18}												OPTIONAL,	-- Need S
+	...
+}
+
+PUSCH-CodeBlockGroupGransmission ::=	SEQUENCE {
+	-- Maximum number of code-block-groups (CBGs) per TB (see 38.xxx, section x.x.x, FFS_Ref)
+	-- For 2 codewords, only the values { n2, n4 } are valid.
+	maxCodeBlockGroupsPerTransportBlock		ENUMERATED {n2, n4, n6, n8},
+	...
+}
+
+-- TAG-PUSCH-SERVINGCELLCONFIG-STOP
+-- TAG-PUSCH-TIMEDOMAINRESOURCEALLOCATION-START
+
+PUSCH-TimeDomainResourceAllocation ::= 	SEQUENCE {
+	-- Corresponds to L1 parameter 'K2' (see 38.214, section FFS_Section)
+	-- When the field is absent the UE applies the value 01 when PUSCH SCS is 15/30KHz; 2 when PUSCH SCS is 60KHz and 3 when PUSCH SCS is 120KHz.
+	k2									INTEGER (0..7)																OPTIONAL,	-- Need S
+	-- Mapping type. Corresponds to L1 parameter 'Mapping-type' (see 38.214, section FFS_Section)
+	mappingType							ENUMERATED {typeA, typeB},
+	-- An index into a table/equation in RAN1 specs capturing valid combinations of start symbol and length (jointly encoded)
+	-- Corresponds to L1 parameter 'Index-start-len' (see 38.214, section FFS_Section)
+	startSymbolAndLength				BIT STRING (SIZE (7))
+}
+
+-- TAG-PUSCH-TIMEDOMAINRESOURCEALLOCATION-STOP
+-- TAG-PUSCH-TPC-COMMANDCONFIG-START
+
+PUSCH-TPC-CommandConfig ::=			SEQUENCE {
+	-- An index determining the position of the first bit of TPC command inside the DCI format 2-2 payload. 
+	tpc-Index							INTEGER (1..15)															OPTIONAL,	-- Cond SUL
+	-- An index determining the position of the first bit of TPC command inside the DCI format 2-2 payload. 
+	tpc-IndexSUL						INTEGER (1..15)															OPTIONAL,	-- Cond SUL-Only
+	-- The serving cell to which the acquired power control commands are applicable. If the value is absent, the UE applies the 
+	-- TPC commands to the serving cell on which the command has been received. 
+	targetCell							ServCellIndex															OPTIONAL,	-- Need S
+	...
+}
+
+-- TAG-PUSCH-TPC-COMMANDCONFIG-STOP
+
+Q-OffsetRange ::=						ENUMERATED {
+												dB-24, dB-22, dB-20, dB-18, dB-16, dB-14,
+												dB-12, dB-10, dB-8, dB-6, dB-5, dB-4, dB-3,
+												dB-2, dB-1, dB0, dB1, dB2, dB3, dB4, dB5,
+												dB6, dB8, dB10, dB12, dB14, dB16, dB18,
+												dB20, dB22, dB24}
+
+-- TAG-QUANTITY-CONFIG-START
+
+	
+QuantityConfig ::=							SEQUENCE {
+	quantityConfigNR-List						QuantityConfigNR-List						OPTIONAL,	-- Need M
+	...
+}
+
+QuantityConfigNR-List::=						SEQUENCE (SIZE (1..maxNrofQuantityConfig)) OF QuantityConfigNR
+
+QuantityConfigNR::=							SEQUENCE {
+	quantityConfigCell							QuantityConfigRS,
+	quantityConfigRS-Index						QuantityConfigRS								OPTIONAL	-- Need M
+}
+
+QuantityConfigRS ::=						SEQUENCE {
+	-- SS Block based L3 filter configurations:
+	ssb-FilterConfig				FilterConfig,
+
+	-- CSI-RS basedL3 filter configurations:
+	cs-RS-FilterConfig				FilterConfig
+}
+
+FilterConfig ::=				SEQUENCE {
+	filterCoefficientRSRP			FilterCoefficient										DEFAULT fc4,
+	filterCoefficientRSRQ			FilterCoefficient										DEFAULT fc4,
+	filterCoefficientRS-SINR		FilterCoefficient										DEFAULT fc4
+}
+
+-- TAG-QUANTITY-CONFIG-STOP
+-- TAG-RACH-CONFIG-COMMON-START
+
+RACH-ConfigCommon ::= 				SEQUENCE {
+	-- Generic RACH parameters 
+	rach-ConfigGeneric			RACH-ConfigGeneric,
+
+	-- Total number of preambles used for contention based and contention free random access, excluding	
+	-- preambles used for other purposes (e.g. for SI request). If the field is absent, the UE may use all 64 preambles for RA.
+	totalNumberOfRA-Preambles			INTEGER (1..63)																		OPTIONAL,	-- Need S
+
+	-- Number of SSBs per RACH occasion (L1 parameter 'SSB-per-rach-occasion') and the number of Contention Based preambles per SSB
+	-- (L1 parameter 'CB-preambles-per-SSB'). By multiplying the two values, the UE determines the total number of CB preambles.
+	ssb-perRACH-OccasionAndCB-PreamblesPerSSB	CHOICE { 
+		oneEighth								ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, 
+		oneFourth								ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, 
+		oneHalf									ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, 
+		one										ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, 
+		two										ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32}, 
+		four									INTEGER (1..16), 
+		eight									INTEGER (1..8), 
+		sixteen									INTEGER (1..4)
+	}																														OPTIONAL,	-- Need M
+
+	groupBconfigured 					SEQUENCE {
+		-- Transport Blocks size threshold in bit below which the UE shall use a contention based RA premable 
+		-- of group A. (see 38.321, section 5.1.2)
+		ra-Msg3SizeGroupA					ENUMERATED {b56, b144, b208, b256, b282, b480, b640, b800, b1000, spare7, spare6, spare5,
+											spare4, spare3, spare2, spare1},
+		-- Threshold for preamble selection.  Value in dB.  Value minusinfinity corresponds to –infinity.  
+		-- Value dB0 corresponds to 0 dB, dB5 corresponds to 5 dB and so on. (see FFS_Spec, section FFS_Section)
+		messagePowerOffsetGroupB			ENUMERATED { minusinfinity, dB0, dB5, dB8, dB10, dB12, dB15, dB18},
+		-- The number of CB preambles per SSB in group A. This determines implicitly the number of CB preambles per SSB available in group B.
+		-- (see 38.321, section 5.1.1)
+		numberOfRA-PreamblesGroupA			INTEGER (1..64)
+	}																														OPTIONAL,	-- Need R
+
+	-- The initial value for the contention resolution timer (see 38.321, section 5.1.5)	
+	ra-ContentionResolutionTimer			ENUMERATED { sf8, sf16, sf24, sf32, sf40, sf48, sf56, sf64},
+
+	-- UE may select the SS block and corresponding PRACH resource for path-loss estimation and (re)transmission 
+	-- based on SS blocks that satisfy the threshold (see 38.213, section REF)
+	rsrp-ThresholdSSB						RSRP-Range																		OPTIONAL,	-- Need R
+	-- UE may select the SS block and corresponding PRACH resource for path-loss estimation and (re)transmission on the SUL carrier
+	-- based on SS blocks that satisfy the threshold
+	-- Corresponds to L1 parameter 'SUL-RSRP-Threshold' (see FFS_Spec, section FFS_Section)
+	rsrp-ThresholdSSB-SUL					RSRP-Range																		OPTIONAL,	-- Need R
+
+	-- PRACH root sequence index. Corresponds to L1 parameter 'PRACHRootSequenceIndex' (see 38.211, section 6.3.3.1).
+	-- The value range depends on whether L=839 or L=139
+	prach-RootSequenceIndex					CHOICE {
+		l839									INTEGER (0..837),
+		l139									INTEGER (0..137)
+	},
+
+	-- Subcarrier spacing of PRACH. Only the values 15 or 30 kHz  (<6GHz), 60 or 120 kHz (>6GHz) are applicable.
+	-- Corresponds to L1 parameter 'prach-Msg1SubcarrierSpacing' (see 38.211, section FFS_Section)
+	msg1-SubcarrierSpacing					SubcarrierSpacing,
+
+	-- Configuration of an unrestricted set or one of two types of restricted sets, see 38.211	6.3.3.1 
+	restrictedSetConfig						ENUMERATED {unrestrictedSet, restrictedSetTypeA, restrictedSetTypeB},
+	-- Indicates to a UE whether transform precoding is enabled for Msg3 transmission. 
+	-- Corresponds to L1 parameter 'msg3-tp' (see 38.213, section 8.1)
+	msg3-transformPrecoding					ENUMERATED {enabled}															OPTIONAL,	-- Need R
+	...
+}
+
+-- TAG-RACH-CONFIG-COMMON-STOP 
+-- TAG-RACH-CONFIG-GENERIC-START
+
+RACH-ConfigGeneric ::= 			SEQUENCE {
+	-- PRACH configuration index. Corresponds to L1 parameter 'PRACHConfigurationIndex' (see 38.211, section 6.3.3.2)
+	prach-ConfigurationIndex				INTEGER (0..255),
+	-- The number of PRACH transmission occasions FDMed in one time instance. 
+	-- Corresponds to L1 parameter 'prach-FDM' (see 38.211, section FFS_Section)
+	msg1-FDM								ENUMERATED {one, two, four, eight},
+	-- Offset of lowest PRACH transmission occasion in frequency domain with respective to PRB 0.
+	-- The value is configured so that the corresponding RACH resource is entirely within the bandwidth of the UL BWP.
+	-- Corresponds to L1 parameter 'prach-frequency-start' (see 38,211, section FFS_Section)
+	msg1-FrequencyStart						INTEGER (0..maxNrofPhysicalResourceBlocks-1),
+	-- N-CS configuration, see Table 6.3.3.1-3 in 38.211
+	zeroCorrelationZoneConfig				INTEGER(0..15),
+	-- The target power level at the network receiver side (see 38.213, section 7.4, 38.321, section 5.1.2, 5.1.3)
+	-- Only multiples of 2 dBm may be chosen (e.g. -200, -198, ...).
+	-- FFS-Value: Actual values to be updated based on input from RAN4 (see LS in R2-1800004 and R4-1803466).
+	preambleReceivedTargetPower				INTEGER (-200..-74),
+	-- Max number of RA preamble transmission perfomed before declaring a failure (see 38.321, section 5.1.4, 5.1.5)
+	preambleTransMax 						ENUMERATED {n3, n4, n5, n6, n7,	n8, n10, n20, n50, n100, n200},
+	-- Power ramping steps for PRACH (see 38.321,5.1.3)
+	powerRampingStep						ENUMERATED {dB0, dB2, dB4, dB6},
+	-- Msg2 (RAR) window length in number of slots. The network configures a value lower than or euqal to 10 ms (see 38.321, section 5.1.4)
+	ra-ResponseWindow						ENUMERATED {sl1, sl2, sl4, sl8, sl10, sl20, sl40, sl80}
+}
+
+-- TAG-RACH-CONFIG-GENERIC-STOP 
+-- TAG-RACH-CONFIG-DEDICATED-START
+
+-- FFS_Standlone: resources for msg1-based on-demand SI request
+
+RACH-ConfigDedicated ::=		SEQUENCE {
+	-- Resources for contention free random access to a given target cell
+	cfra-Resources					CFRA-Resources, 
+	...
+}
+
+CFRA-Resources ::= 				CHOICE {
+	ssb								SEQUENCE {
+		ssb-ResourceList				SEQUENCE (SIZE(1..maxRA-SSB-Resources)) OF CFRA-SSB-Resource,
+		-- Explicitly signalled PRACH Mask Index for RA Resource selection in TS 36.321. The mask is valid for all SSB
+		-- resources signalled in ssb-ResourceList
+		ra-ssb-OccasionMaskIndex		INTEGER (0..15)
+	},
+	csirs							SEQUENCE {
+		csirs-ResourceList				SEQUENCE (SIZE(1..maxRA-CSIRS-Resources)) OF CFRA-CSIRS-Resource,
+		cfra-csirs-DedicatedRACH-Threshold	RSRP-Range
+	}
+}
+
+CFRA-SSB-Resource ::= 			SEQUENCE {
+	-- The ID of an SSB transmitted by this serving cell. 
+	ssb								SSB-Index,
+	-- The preamble index that the UE shall use when performing CF-RA upon selecting the candidate beams identified by this SSB.
+	ra-PreambleIndex				INTEGER (0..63),
+	...
+}
+
+CFRA-CSIRS-Resource ::= 		SEQUENCE {
+	-- The ID of a CSI-RS resource defined in the measurement object associated with this serving cell.
+	csi-RS							CSI-RS-Index,
+	-- RA occasions that the UE shall use when performing CF-RA upon selecting the candidate beam identified by this CSI-RS.
+	ra-OccasionList					SEQUENCE (SIZE(1..maxRA-OccasionsPerCSIRS)) OF INTEGER (0..maxRA-Occasions-1),
+	-- The RA preamble index to use in the RA occasions assoicated with this CSI-RS.
+	ra-PreambleIndex				INTEGER (0..63),	
+	...
+}
+
+-- TAG-RACH-CONFIG-DEDICATED-STOP
+-- TAG-RADIO-BEARER-CONFIG-START
+
+RadioBearerConfig ::=					SEQUENCE {
+	srb-ToAddModList						SRB-ToAddModList										OPTIONAL, -- Need N
+	srb3-ToRelease							ENUMERATED{true}										OPTIONAL, -- Need N
+	drb-ToAddModList						DRB-ToAddModList										OPTIONAL, -- Need N
+	drb-ToReleaseList						DRB-ToReleaseList										OPTIONAL, -- Need N
+	securityConfig 							SecurityConfig											OPTIONAL, -- Cond M
+	...
+}
+
+SRB-ToAddModList ::=					SEQUENCE (SIZE (1..2)) OF SRB-ToAddMod
+SRB-ToAddMod ::=						SEQUENCE {
+	srb-Identity							SRB-Identity,
+	-- may only be set if the cell groups of all linked logical channels are reset or released
+	reestablishPDCP							ENUMERATED{true}										OPTIONAL, 		-- Need N
+	discardOnPDCP                           ENUMERATED{true}										OPTIONAL,		-- Need N
+	pdcp-Config								PDCP-Config												OPTIONAL,		-- Cond PDCP
+	...
+}
+
+
+DRB-ToAddModList ::=					SEQUENCE (SIZE (1..maxDRB)) OF DRB-ToAddMod
+DRB-ToAddMod ::=						SEQUENCE {
+	cnAssociation							CHOICE {
+		-- The EPS bearer ID determines the EPS bearer when NR connects to EPC using EN-DC
+		eps-BearerIdentity						INTEGER (0..15),												-- EPS-DRB-Setup
+		--	The SDAP configuration determines how to map QoS flows to DRBs when NR connects to the 5GC
+		sdap-Config								SDAP-Config													-- 5GC
+	} 										OPTIONAL, -- Cond DRBSetup
+	drb-Identity							DRB-Identity,
+
+	-- may only be set if the cell groups of all linked logical channels are reset or released
+	reestablishPDCP						ENUMERATED{true}										OPTIONAL, 		-- Need N
+	recoverPDCP							ENUMERATED{true}										OPTIONAL, 		-- Need N
+	pdcp-Config							PDCP-Config												OPTIONAL,		-- Cond PDCP
+	...
+}
+
+DRB-ToReleaseList ::=					SEQUENCE (SIZE (1..maxDRB)) OF DRB-Identity
+
+
+SecurityConfig ::=						SEQUENCE {	
+	securityAlgorithmConfig				SecurityAlgorithmConfig									OPTIONAL,	-- Cond RBTermChange
+	keyToUse							ENUMERATED{keNB, s-KgNB}								OPTIONAL,	-- Cond RBTermChange
+	...
+}
+
+-- TAG-RADIO-BEARER-CONFIG-STOP
+-- TAG-RADIOLINKMONITORINGCONFIG-START
+
+RadioLinkMonitoringConfig ::=			SEQUENCE {
+	-- A list of reference signals for detecting beam failure and/or cell level radio link failure (RLF).
+	-- The network configures at most two detectionResources per BWP for the purpose "beamFailure" or "both". 
+	-- If no RSs are provided for the purpose of beam failure detection, the UE performs beam monitoring based on the activated TCI-State 
+	-- for PDCCH. However, if the activated TCI state refers to an aperiodic or semi-persistent CSI-RS, the gNB configures the failure
+	-- detection resources explicitly (FFS_RAN1: TBC by RAN1).
+	-- If no RSs are provided in this list at all (neither for Cell- nor for Beam-RLM), the UE performs also Cell-RLM based 
+	-- on the activated TCI-State of PDCCH (FFS_RAN1: TBC by RAN1).
+	-- When the network reconfigures this field, the UE resets on-going RLF timers and counters.
+	failureDetectionResources				SEQUENCE (SIZE(1..maxNrofFailureDetectionResources)) OF RadioLinkMonitoringRS	OPTIONAL, 	-- Need M
+	-- This field determines after how many beam failure events the UE triggers beam failure recovery (see 38.321, section 5.17). 
+	-- Value n1 corresponds to 1 beam failure instance, n2 corresponds to 2 beam failure instances and so on. 
+	-- When the network reconfigures this field, the UE resets on-going RLF timers and counters. 
+	-- If the field is absent, the UE does not trigger beam failure recovery.
+	beamFailureInstanceMaxCount				ENUMERATED {n1, n2, n3, n4, n5, n6, n8, n10}									OPTIONAL,	-- Need S
+	-- Timer for beam failure detection (see 38.321, section FFS_Section). See also the BeamFailureRecoveryConfig IE.
+	-- Value in number of "periods of Beam Failure Detection" Reference Signal. Value pbfd1 corresponds to 1 period of Beam Failure 
+	-- Detection Reference Signal, value pbfd2 corresponds to 2 periods of Beam Failure Detection Reference Signal and so on.
+	-- When the network reconfigures this field, the UE resets on-going RLF timers and counters.
+	beamFailureDetectionTimer      			ENUMERATED {pbfd1, pbfd2, pbfd3, pbfd4, pbfd5, pbfd6, pbfd8, pbfd10}			OPTIONAL,	-- Need R
+	...
+}
+
+RadioLinkMonitoringRS ::=				SEQUENCE {
+	-- Determines whether the UE shall monitor the associated reference signal for the purpose of cell- and/or beam failure detection.
+	purpose									ENUMERATED {beamFailure, rlf, both},
+	-- A reference signal that the UE shall use for radio link monitoring. The network provides an ssb-Index only if
+	-- the purpose is set to rlf.
+	detectionResource						CHOICE {
+		ssb-Index								SSB-Index,
+		csi-RS-Index							NZP-CSI-RS-ResourceId
+	},
+	...
+}
+
+-- TAG-RADIOLINKMONITORINGCONFIG-STOP
+-- TAG-RATEMATCHPATTERN-START
+RateMatchPattern ::= 						SEQUENCE {
+	rateMatchPatternId							RateMatchPatternId,
+
+	patternType									CHOICE {
+		bitmaps										SEQUENCE {
+			-- A resource block level bitmap in the frequency domain. It indicates the PRBs to which the symbolsInResourceBlock bitmap applies.
+			-- Corresponds to L1 parameter 'rate-match-PDSCH-bitmap1' (see 38.214, section FFS_Section)
+			-- FFS_ASN1: Consider multiple options with different number of bits (for narrower carriers)
+			resourceBlocks								BIT STRING (SIZE (275)),
+
+			-- A symbol level bitmap in time domain. It indicates (FFS: with a bit set to true) the symbols which the UE shall rate match around.
+			-- This pattern recurs (in time domain) with the configured periodicityAndOffset. 
+			-- Corresponds to L1 parameter 'rate-match-PDSCH-bitmap2' (see 38.214, section FFS_Section)
+			-- FFS: Why not split it into two BIT STRINGs of 14 bit each?
+			symbolsInResourceBlock						CHOICE {
+				oneSlot										BIT STRING (SIZE (14)),
+				twoSlots									BIT STRING (SIZE (28))
+			},
+
+			-- A time domain repetition pattern. at which the symbolsInResourceBlock 
+			-- pattern recurs. This slot pattern repeats itself continuously. Absence of this field indicates the value n1, i.e., the
+			-- symbolsInResourceBlock recurs every 14 symbols. 
+			-- Corresponds to L1 parameter 'rate-match-PDSCH-bitmap3' (see 38.214, section FFS_Section)
+			periodicityAndPattern						CHOICE {
+				n2											BIT STRING (SIZE (2)), 
+				n4											BIT STRING (SIZE (4)), 
+				n5											BIT STRING (SIZE (5)), 
+				n8											BIT STRING (SIZE (8)), 
+				n10											BIT STRING (SIZE (10)), 
+				n20											BIT STRING (SIZE (20)), 
+				n40											BIT STRING (SIZE (40))
+			}																										OPTIONAL, 	-- Need S
+			...
+		},
+		-- This ControlResourceSet us used as a PDSCH rate matching pattern, i.e., PDSCH reception rate matches around it. 
+		controlResourceSet							ControlResourceSetId
+	},
+	-- The SubcarrierSpacing for this resource pattern. If the field is absent, the UE applies the SCS of the associcated BWP. 
+	-- The value kHz15 corresponds to µ=0, kHz30 to µ=1, and so on. Only the values 15 or 30 kHz  (<6GHz), 60 or 120 kHz (>6GHz) are 
+	-- applicable. Corresponds to L1 parameter 'resource-pattern-scs' (see 38.214, section FFS_Section)
+	subcarrierSpacing							SubcarrierSpacing 													OPTIONAL,	-- Cond CellLevel
+	-- FFS_Description, FFS_Section
+	mode										ENUMERATED { dynamic, semiStatic },
+	...
+}
+
+-- TAG-RATEMATCHPATTERN-STOP
+-- TAG-RATEMATCHPATTERNID-START
+
+RateMatchPatternId ::=						INTEGER (0..maxNrofRateMatchPatterns-1)
+
+-- TAG-RATEMATCHPATTERNID-STOP
+-- TAG-RATEMATCHPATTERNLTE-CRS-START
+
+RateMatchPatternLTE-CRS ::=				SEQUENCE {
+	-- Center of the LTE carrier. Corresponds to L1 parameter 'center-subcarrier-location' (see 38.214, section 5.1.4)
+	carrierFreqDL							INTEGER (0..16383),
+	-- BW of the LTE carrier in numbewr of PRBs. Corresponds to L1 parameter 'BW' (see 38.214, section 5.1.4)
+	carrierBandwidthDL						ENUMERATED {n6, n15, n25, n50, n75, n100, spare2, spare1},
+	-- LTE MBSFN subframe configuration. Corresponds to L1 parameter 'MBSFN-subframconfig' (see 38.214, section 5.1.4)
+	-- FFS_ASN1: Import the LTE MBSFN-SubframeConfigList
+	mbsfn-SubframeConfigList				EUTRA-MBSFN-SubframeConfigList						OPTIONAL,	-- Need M
+	-- Number of LTE CRS antenna port to rate-match around. 
+	-- Corresponds to L1 parameter 'rate-match-resources-numb-LTE-CRS-antenna-port' (see 38.214, section 5.1.4)
+	nrofCRS-Ports							ENUMERATED {n1, n2, n4},
+	-- Shifting value v-shift in LTE to rate match around LTE CRS
+	-- Corresponds to L1 parameter 'rate-match-resources-LTE-CRS-v-shift' (see 38.214, section 5.1.4)
+	v-Shift									ENUMERATED {n0, n1, n2, n3, n4, n5}			
+}
+
+-- TAG-RATEMATCHPATTERNLTE-CRS-STOP
+-- TAG-REPORT-CONFIG-ID-START
+
+ReportConfigId ::=							INTEGER (1..maxReportConfigId)
+
+-- TAG-REPORT-CONFIG-ID-STOP
+-- TAG-REPORT-CONFIG-START
+
+ReportConfigNR ::=							SEQUENCE {
+	reportType									CHOICE {
+		periodical									PeriodicalReportConfig, 
+		eventTriggered								EventTriggerConfig,
+-- reportCGI is to be completed before the end of Rel-15.
+		reportCGI									ENUMERATED {ffsTypeAndValue},
+		...
+	}
+}
+
+-- FFS / TODO: Consider separating trgger configuration (trigger, periodic, ...) from report configuration.
+-- Current structure allows easier definiton of new events and new report types e.g. CGI, etc.
+EventTriggerConfig::=						SEQUENCE {
+	eventId										CHOICE {
+		eventA1										SEQUENCE {
+			a1-Threshold								MeasTriggerQuantity,
+			reportOnLeave								BOOLEAN,
+			hysteresis									Hysteresis,
+			timeToTrigger								TimeToTrigger
+		},
+		eventA2										SEQUENCE {
+			a2-Threshold								MeasTriggerQuantity,
+			reportOnLeave								BOOLEAN,
+			hysteresis									Hysteresis,
+			timeToTrigger								TimeToTrigger
+		},
+		eventA3										SEQUENCE {
+			a3-Offset									MeasTriggerQuantityOffset,
+			reportOnLeave								BOOLEAN,
+			hysteresis									Hysteresis,
+			timeToTrigger								TimeToTrigger,
+			useWhiteCellList							BOOLEAN														
+		},
+		eventA4										SEQUENCE {
+			a4-Threshold								MeasTriggerQuantity,
+			reportOnLeave								BOOLEAN,
+			hysteresis									Hysteresis,
+			timeToTrigger								TimeToTrigger,
+			useWhiteCellList							BOOLEAN														
+		},
+		eventA5										SEQUENCE {
+			a5-Threshold1								MeasTriggerQuantity,
+			a5-Threshold2								MeasTriggerQuantity,
+			reportOnLeave								BOOLEAN,
+			hysteresis									Hysteresis,
+			timeToTrigger								TimeToTrigger,
+			useWhiteCellList							BOOLEAN														
+		},
+		eventA6										SEQUENCE {
+			a6-Offset									MeasTriggerQuantityOffset,
+			reportOnLeave								BOOLEAN,
+			hysteresis									Hysteresis,
+			timeToTrigger								TimeToTrigger,
+			useWhiteCellList							BOOLEAN														
+		},
+		...
+	},
+
+	rsType										NR-RS-Type,
+
+	-- Common reporting config (at least to periodical and eventTriggered)
+	reportInterval								ReportInterval,
+	reportAmount								ENUMERATED {r1, r2, r4, r8, r16, r32, r64, infinity},
+
+	-- Cell reporting configuration
+	reportQuantityCell							MeasReportQuantity,
+	maxReportCells								INTEGER (1..maxCellReport),
+
+	-- RS index reporting configuration
+	reportQuantityRsIndexes						MeasReportQuantity													OPTIONAL,	-- Need M
+	maxNrofRSIndexesToReport					INTEGER (1..maxNrofIndexesToReport) 								OPTIONAL,	-- Need M
+	includeBeamMeasurements						BOOLEAN,
+	-- If configured the UE includes the best neighbour cells per serving frequency
+	reportAddNeighMeas							ENUMERATED {setup}									OPTIONAL,		-- Need R
+	...
+
+}
+
+PeriodicalReportConfig ::=					SEQUENCE {
+	rsType										NR-RS-Type,
+
+	-- Common reporting config (at least to periodical and eventTriggered)
+	reportInterval								ReportInterval,
+	reportAmount								ENUMERATED {r1, r2, r4, r8, r16, r32, r64, infinity},
+
+	-- Cell reporting configuration
+	reportQuantityCell							MeasReportQuantity,
+	maxReportCells								INTEGER (1..maxCellReport),
+
+	-- RS index reporting configuration
+	reportQuantityRsIndexes						MeasReportQuantity													OPTIONAL,	-- Need R
+	maxNrofRsIndexesToReport					INTEGER (1..maxNrofIndexesToReport) 									OPTIONAL,	-- Need R
+	includeBeamMeasurements						BOOLEAN,
+	useWhiteCellList							BOOLEAN,
+	...
+
+}
+
+NR-RS-Type ::= ENUMERATED {ssb, csi-rs}
+
+MeasTriggerQuantity ::=						CHOICE {
+	rsrp										RSRP-Range,
+	rsrq										RSRQ-Range,
+	sinr										SINR-Range
+}
+
+MeasTriggerQuantityOffset ::=				CHOICE {
+	rsrp										INTEGER (-30..30),														
+	rsrq										INTEGER (-30..30),														
+	sinr										INTEGER (-30..30)														
+}
+
+			
+MeasReportQuantity ::=						SEQUENCE {
+	rsrp										BOOLEAN,
+	rsrq										BOOLEAN,
+	sinr										BOOLEAN
+}
+
+
+-- TAG-REPORT-CONFIG-START
+-- TAG-REPORT-CONFIG-TO-ADD-MOD-LIST-START
+
+ReportConfigToAddModList ::=		SEQUENCE (SIZE (1..maxReportConfigId)) OF ReportConfigToAddMod
+
+ReportConfigToAddMod ::=	SEQUENCE {
+	reportConfigId						ReportConfigId,
+	reportConfig						CHOICE {
+		reportConfigNR						ReportConfigNR,
+		...
+	}
+}
+
+-- TAG- REPORT-CONFIG-TO-ADD-MOD-LIST-STOP
+
+ReportInterval ::=					ENUMERATED {ms120, ms240, ms480, ms640, ms1024, ms2048, ms5120, ms10240, ms20480, ms40960, min1,
+													min6, min12, min30 }
+
+-- TAG-RLC-CONFIG-START
+
+RLC-Config ::=						CHOICE {
+	am									SEQUENCE {
+		ul-AM-RLC							UL-AM-RLC,
+		dl-AM-RLC							DL-AM-RLC
+	},
+	um-Bi-Directional					SEQUENCE {
+		ul-UM-RLC							UL-UM-RLC,
+		dl-UM-RLC							DL-UM-RLC
+	},
+	um-Uni-Directional-UL				SEQUENCE {
+		ul-UM-RLC							UL-UM-RLC
+	},
+	um-Uni-Directional-DL				SEQUENCE {
+		dl-UM-RLC							DL-UM-RLC
+	},
+	...
+}
+
+UL-AM-RLC ::=						SEQUENCE {
+	sn-FieldLength						SN-FieldLengthAM,
+	t-PollRetransmit					T-PollRetransmit,
+	pollPDU								PollPDU,
+	pollByte							PollByte,
+	maxRetxThreshold					ENUMERATED { t1, t2, t3, t4, t6, t8, t16, t32 }
+}
+
+DL-AM-RLC ::=						SEQUENCE {
+	sn-FieldLength						SN-FieldLengthAM,
+	t-Reassembly						T-Reassembly,
+	t-StatusProhibit					T-StatusProhibit
+}
+
+UL-UM-RLC ::=						SEQUENCE {
+	sn-FieldLength						SN-FieldLengthUM
+}
+
+DL-UM-RLC ::=						SEQUENCE {
+	sn-FieldLength						SN-FieldLengthUM,
+	t-Reassembly						T-Reassembly
+}
+
+T-PollRetransmit ::=				ENUMERATED {
+										ms5, ms10, ms15, ms20, ms25, ms30, ms35,
+										ms40, ms45, ms50, ms55, ms60, ms65, ms70,
+										ms75, ms80, ms85, ms90, ms95, ms100, ms105,
+										ms110, ms115, ms120, ms125, ms130, ms135,
+										ms140, ms145, ms150, ms155, ms160, ms165,
+										ms170, ms175, ms180, ms185, ms190, ms195,
+										ms200, ms205, ms210, ms215, ms220, ms225,
+										ms230, ms235, ms240, ms245, ms250, ms300,
+										ms350, ms400, ms450, ms500, ms800, ms1000,
+										ms2000, ms4000, spare5, spare4, spare3,
+										spare2, spare1}
+
+
+PollPDU ::=							ENUMERATED {
+										p4, p8, p16, p32, p64, p128, p256, p512, p1024, p2048, p4096, p6144, p8192, p12288, p16384, p20480,
+										p24576, p28672, p32768, p40960, p49152, p57344, p65536, infinity, spare8, spare7, spare6, spare5, spare4,
+										spare3, spare2, spare1}
+
+PollByte ::=						ENUMERATED {
+										kB1, kB2, kB5, kB8, kB10, kB15, kB25, kB50, kB75,
+										kB100, kB125, kB250, kB375, kB500, kB750, kB1000,
+										kB1250, kB1500, kB2000, kB3000, kB4000, kB4500,
+										kB5000, kB5500, kB6000, kB6500, kB7000, kB7500,
+										mB8, mB9, mB10, mB11, mB12, mB13, mB14, mB15,
+										mB16, mB17, mB18, mB20, mB25, mB30, mB40, infinity,
+										spare20, spare19, spare18, spare17, spare16,
+										spare15, spare14, spare13, spare12, spare11,
+										spare10, spare9, spare8, spare7, spare6, spare5,
+										spare4, spare3, spare2, spare1}
+
+T-Reassembly ::=					ENUMERATED {
+										ms0, ms5, ms10, ms15, ms20, ms25, ms30, ms35,
+										ms40, ms45, ms50, ms55, ms60, ms65, ms70,
+										ms75, ms80, ms85, ms90, ms95, ms100, ms110,
+										ms120, ms130, ms140, ms150, ms160, ms170,
+										ms180, ms190, ms200, spare1}
+
+T-StatusProhibit ::=				ENUMERATED {
+										ms0, ms5, ms10, ms15, ms20, ms25, ms30, ms35,
+										ms40, ms45, ms50, ms55, ms60, ms65, ms70,
+										ms75, ms80, ms85, ms90, ms95, ms100, ms105,
+										ms110, ms115, ms120, ms125, ms130, ms135,
+										ms140, ms145, ms150, ms155, ms160, ms165,
+										ms170, ms175, ms180, ms185, ms190, ms195,
+										ms200, ms205, ms210, ms215, ms220, ms225,
+										ms230, ms235, ms240, ms245, ms250, ms300,
+										ms350, ms400, ms450, ms500, ms800, ms1000,
+										ms1200, ms1600, ms2000, ms2400, spare2, spare1}
+
+SN-FieldLengthUM ::=				ENUMERATED {size6, size12}
+SN-FieldLengthAM ::=				ENUMERATED {size12, size18}
+
+-- TAG-RLC-CONFIG-STOP
+-- TAG-RLF-TIMERS-AND-CONSTANTS-START
+
+RLF-TimersAndConstants ::= 			SEQUENCE {
+	t310								ENUMERATED {ms0, ms50, ms100, ms200, ms500, ms1000, ms2000, ms4000, ms6000},
+	n310								ENUMERATED {n1, n2, n3, n4, n6, n8, n10, n20},
+	n311								ENUMERATED {n1, n2, n3, n4, n5, n6, n8, n10},
+	...
+}
+
+-- TAG-RLF-TIMERS-AND-CONSTANTS-STOP
+-- TAG-RNTI-VALUE-START
+
+RNTI-Value ::=						INTEGER (0..65535)
+
+-- TAG-RNTI-VALUE-STOP
+-- TAG-RSRP-RANGE-START
+
+RSRP-Range ::=						INTEGER(0..124)
+
+-- TAG-RSRP-RANGE-STOP
+-- TAG-RSRQ-RANGE-START
+
+RSRQ-Range ::=						INTEGER(0..127)
+
+-- TAG-RSRQ-RANGE-STOP
+-- TAG-SCELL-INDEX-START
+
+-- The value range is shared across the Cell Groups 
+SCellIndex ::=						INTEGER (1..31)
+
+-- TAG-SCELL-INDEX-STOP
+-- TAG-SCHEDULING-REQUEST-CONFIG-START
+
+SchedulingRequestConfig ::= 		SEQUENCE {
+	schedulingRequestToAddModList		SEQUENCE (SIZE (1..maxNrofSR-ConfigPerCellGroup)) OF SchedulingRequestToAddMod			OPTIONAL, -- Need N
+	schedulingRequestToReleaseList		SEQUENCE (SIZE (1..maxNrofSR-ConfigPerCellGroup)) OF SchedulingRequestId				OPTIONAL  -- Need N
+}
+
+SchedulingRequestToAddMod ::=		SEQUENCE {
+	sr-ConfigIndex		SchedulingRequestId,
+
+	sr-ProhibitTimer					ENUMERATED {ms1, ms2, ms4, ms8, ms16, ms32, ms64, ms128}					OPTIONAL,	-- Need S
+	sr-TransMax							ENUMERATED { n4, n8, n16, n32, n64, spare3, spare2, spare1}
+}
+
+SchedulingRequestId ::=	INTEGER (0..7)
+
+-- FFS_TODO: provide resources for each SchedulingRequestID in ServingCellConfig (TBD whether directly, in PUCCH-Config, in each BWP)
+
+-- TAG-SCHEDULING-REQUEST-CONFIG-STOP
+-- TAG-SCHEDULING-REQUEST-RESOURCE-CONFIG-START
+
+SchedulingRequestResourceConfig ::=			SEQUENCE {
+	schedulingRequestResourceId						SchedulingRequestResourceId,
+	-- The ID of the SchedulingRequestConfig that uses this scheduling request resource.
+	schedulingRequestID								SchedulingRequestId,
+	-- SR periodicity and offset in number of slots. Corresponds to L1 parameter 'SR-periodicity' and 'SR-offset' (see 38.213, section 9.2.2)	
+	-- The following periodicities may be configured depending on the chosen subcarrier spacing:
+	-- SCS =  15 kHz: 2sym, 7sym, 1sl, 2sl, 4sl, 5sl, 8sl, 10sl, 16sl, 20sl, 40sl, 80sl
+	-- SCS =  30 kHz: 2sym, 7sym, 1sl, 2sl, 4sl, 8sl, 10sl, 16sl, 20sl, 40sl, 80sl, 160sl
+	-- SCS =  60 kHz: 2sym, 7sym/6sym, 1sl, 2sl, 4sl, 8sl, 16sl, 20sl, 40sl, 80sl, 160sl, 320sl
+	-- SCS = 120 kHz: 2sym, 7sym, 1sl, 2sl, 4sl, 8sl, 16sl, 40sl, 80sl, 160sl, 320sl, sl640
+	-- sym6or7 corresponds to 6 symbols if extended cyclic prefix and a SCS of 60 kHz are configured, otherwise it corresponds to 7 symbols.
+	-- For periodicities sym2, sym7 and sl1 the UE assumes an offset of 0 slots.
+	periodicityAndOffset							CHOICE {
+		sym2											NULL,						
+		sym6or7											NULL,						
+		sl1												NULL,						-- Recurs in every slot
+		sl2												INTEGER (0..1),
+		sl4												INTEGER (0..3),
+		sl5												INTEGER (0..4),
+		sl8												INTEGER (0..7),
+		sl10											INTEGER (0..9),
+		sl16											INTEGER (0..15),
+		sl20											INTEGER (0..19),
+		sl40											INTEGER (0..39),
+		sl80											INTEGER (0..79),
+		sl160											INTEGER (0..159),
+		sl320											INTEGER (0..319),
+		sl640											INTEGER (0..639)
+	}																														OPTIONAL,	-- Need M
+	-- ID of the PUCCH resource in which the UE shall send the scheduling request. The 
+	-- actual PUCCH-Resource is configured in PUCCH-Config of the same UL BWP and serving cell as this SchedulingRequestResourceConfig. 
+	-- The network configures a PUCCH-Resource of PUCCH-format0 or PUCCH-format1 
+	-- (other formats not supported). Corresponds to L1 parameter 'SR-resource' (see 38.213, section 9.2.2)
+	resource										PUCCH-ResourceId														OPTIONAL	-- Need M
+}
+
+-- TAG-SCHEDULING-REQUEST-RESOURCE-CONFIG-STOP
+-- TAG-SCHEDULINGREQUESTRESOURCEID-START
+
+SchedulingRequestResourceId ::=					INTEGER (1..maxNrofSR-Resources)
+
+-- TAG-SCHEDULINGREQUESTRESOURCEID-STOP
+-- TAG-SCRAMBLING-ID-START
+
+ScramblingId ::=					INTEGER (0..1023)
+
+-- TAG-SCRAMBLING-ID-STOP
+-- TAG-SCS-SPECIFIC-CARRIER-START
+
+SCS-SpecificCarrier ::=			SEQUENCE {
+	-- Offset in frequency domain between Point A (lowest subcarrier of common RB 0) and the lowest usable subcarrier on this carrier
+	-- in number of PRBs (using the subcarrierSpacing defined for this carrier). The maximum value corresponds to 275*8-1. 
+	-- Corresponds to L1 parameter 'offset-pointA-low-scs' (see 38.211, section FFS_Section)
+	offsetToCarrier				INTEGER (0..2199),
+	-- Subcarrier spacing of this carrier. It is used to convert the offsetToCarrier into an actual frequency. 
+	-- Only the values 15 or 30 kHz  (<6GHz), 60 or 120 kHz (>6GHz) are applicable.
+	-- Corresponds to L1 parameter 'ref-scs' (see 38.211, section FFS_Section)
+	subcarrierSpacing					SubcarrierSpacing,
+	-- Corresponds to L1 parameter k0 (see 38.211, section 5.3.1). n-6 corresponds to value -6, n0 corresponds to value 0 and n6 corresponds
+	-- to value +6.
+	k0									ENUMERATED {n-6, n0, n6}, 
+	-- Width of this carrier in number of PRBs (using the subcarrierSpacing defined for this carrier)
+	-- Corresponds to L1 parameter 'BW' (see 38.211, section FFS_Section)
+	carrierBandwidth					INTEGER (1..maxNrofPhysicalResourceBlocks),
+	...
+}
+
+-- TAG-SCS-SPECIFIC-CARRIER-STOP 
+-- TAG-SDAP-CONFIG-START
+
+SDAP-Config ::=						SEQUENCE {
+	pdu-Session							PDU-SessionID,
+
+	-- FFS: separate configuration for UL and DL
+	sdap-HeaderDL 						ENUMERATED {present, absent},
+	sdap-HeaderUL 						ENUMERATED {present, absent},
+	defaultDRB							BOOLEAN,
+
+	-- A list of QoS-Flow-IDs that the UE shall map to the DRB of this SDAP-Config.
+	mappedQoS-FlowsToAdd				SEQUENCE (SIZE (1..maxNrofQFIs)) OF QFI 									OPTIONAL, -- Need N
+	-- A list of QoS-Flow-IDs that the UE shall no longer map to the DRB of this SDAP-Config.
+	mappedQoS-FlowsToRelease			SEQUENCE (SIZE (1..maxNrofQFIs)) OF QFI 									OPTIONAL, -- Need N
+	...
+}
+
+QFI ::= 							INTEGER (0..maxQFI)
+
+PDU-SessionID ::= INTEGER (0..255)
+
+-- TAG-SDAP-CONFIG-STOP
+-- TAG-SEARCHSPACE-START
+
+SearchSpace ::= 						SEQUENCE {
+	-- Identity of the search space. SearchSpaceId = 0 identifies the SearchSpace configured via PBCH (MIB) or ServingCellConfigCommon.
+	-- The searchSpaceId is unique among the BWPs of a Serving Cell. 
+	searchSpaceId							SearchSpaceId,
+
+	-- The CORESET applicable for this SearchSpace. 
+	-- Value 0 identifies the common CORESET configured in MIB and in ServingCellConfigCommon
+	-- Values 1..maxNrofControlResourceSets-1 identify CORESETs configured by dedicated signalling
+	controlResourceSetId					ControlResourceSetId														OPTIONAL, 	-- Cond SetupOnly
+
+	-- Slots for PDCCH Monitoring configured as periodicity and offset. Corresponds to L1 parameters 'Montoring-periodicity-PDCCH-slot' and 
+	-- 'Montoring-offset-PDCCH-slot' (see 38.213, section 10)
+	monitoringSlotPeriodicityAndOffset		CHOICE {
+		sl1										NULL, 
+		sl2										INTEGER (0..1), 
+		sl4										INTEGER (0..3), 
+		sl5 									INTEGER (0..4),
+		sl8										INTEGER (0..7), 
+		sl10 									INTEGER (0..9),
+		sl16 									INTEGER (0..15),
+		sl20 									INTEGER (0..19)
+	}																													OPTIONAL,	-- Cond Setup
+
+	-- Symbols for PDCCH monitoring in the slots configured for PDCCH monitoring (see monitoringSlotPeriodicityAndOffset).
+	-- The most significant (left) bit represents the first OFDM in a slot. The least significant (right) bit represents the last symbol. 
+	-- Corresponds to L1 parameter 'Montoring-symbols-PDCCH-within-slot' (see 38.213, section 10)
+	monitoringSymbolsWithinSlot					BIT STRING (SIZE (14))													OPTIONAL, 	-- Cond Setup
+
+	-- Number of PDCCH candidates per aggregation level. Corresponds to L1 parameter 'Aggregation-level-1' to 'Aggregation-level-8'.
+	-- The number of candidates and aggregation levels configured here applies to all formats unless a particular value is specified or
+	-- a format-specific value is provided (see inside searchSpaceType). 
+	-- (see 38.213, section 10)
+	nrofCandidates							SEQUENCE {
+		aggregationLevel1						ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8},
+		aggregationLevel2						ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8},
+		aggregationLevel4						ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8},
+		aggregationLevel8						ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8},
+		aggregationLevel16						ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8}
+	}																													OPTIONAL,	-- Cond Setup
+
+	-- Indicates whether this is a common search space (present) or a UE specific search space as well as DCI formats to monitor for.
+	searchSpaceType							CHOICE {
+		-- Configures this search space as common search space (CSS) and DCI formats to monitor.
+		common									SEQUENCE {
+			-- If configured, the UE monitors the DCI formats 0_0 and 1_0 with CRC scrambled by C-RNTI, CS-RNTI (if configured), 
+			-- SP-CSI-RNTI (if configured), RA-RNTI, TC-RNTI, P-RNTI, SI-RNTI
+			dci-Format0-0-AndFormat1-0					SEQUENCE {
+				...
+			}																											OPTIONAL,	-- Need R
+			-- If configured, UE monitors the DCI format format 2_0 with CRC scrambled by SFI-RNTI
+			dci-Format2-0								SEQUENCE {
+				-- The number of PDCCH candidates specifically for format 2-0 for the configured aggregation level.
+				-- If an aggregation level is absent, the UE does not search for any candidates with that aggregation level.
+				-- Corresponds to L1 parameters 'SFI-Num-PDCCH-cand' and 'SFI-Aggregation-Level' (see 38.213, section 11.1.1).
+				nrofCandidates-SFI							SEQUENCE {
+					aggregationLevel1							ENUMERATED {n1, n2}										OPTIONAL,	-- Need R
+					aggregationLevel2							ENUMERATED {n1, n2}										OPTIONAL,	-- Need R
+					aggregationLevel4							ENUMERATED {n1, n2}										OPTIONAL,	-- Need R
+					aggregationLevel8							ENUMERATED {n1, n2}										OPTIONAL,	-- Need R
+					aggregationLevel16							ENUMERATED {n1, n2}										OPTIONAL	-- Need R
+				},
+				...
+			}																											OPTIONAL,	-- Need R
+			-- If configured, UE monitors the DCI format format 2_1 with CRC scrambled by INT-RNTI
+			dci-Format2-1								SEQUENCE {
+				...
+			}																											OPTIONAL,	-- Need R
+			-- If configured, UE monitors the DCI format 2_2 with CRC scrambled by TPC-PUSCH-RNTI or TPC-PUCCH-RNTI
+			dci-Format2-2								SEQUENCE {
+				...
+			}																											OPTIONAL,	-- Need R
+			-- If configured, UE monitors the DCI format 2_3 with CRC scrambled by TPC-SRS-RNTI
+			dci-Format2-3								SEQUENCE {
+				-- Monitoring periodicity of SRS PDCCH in number of slots for DCI format 2-3. 
+				-- Corresponds to L1 parameter 'SRS-monitoring-periodicity' (see 38.212, 38.213, section 7.3.1, 11.3)
+				monitoringPeriodicity				ENUMERATED {n1, n2, n4, n5, n8, n10, n16, n20 }						OPTIONAL, 	-- Cond Setup
+
+				-- The number of PDCCH candidates for DCI format 2-3 for the configured aggregation level.
+				-- Corresponds to L1 parameter 'SRS-Num-PDCCH-cand' (see 38.212, 38.213, section 7.3.1, 11.3)
+				nrofPDCCH-Candidates				ENUMERATED {n1, n2},
+				...
+			}																											OPTIONAL	-- Need R
+		},
+		-- Configures this search space as UE specific search space (USS). The UE monitors the DCI format with CRC scrambled 
+		-- by C-RNTI, CS-RNTI (if configured), TC-RNTI (if a certain condition is met), and SP-CSI-RNTI (if configured)
+		ue-Specific								SEQUENCE {
+			-- Indicates whether the UE monitors in this USS for DCI formats 0-0 and 1-0 or for formats 0-1 and 1-1.
+			dci-Formats									ENUMERATED {formats0-0-And-1-0, formats0-1-And-1-1},
+			... 
+		}
+	}																													OPTIONAL	-- Cond Setup
+}
+-- TAG-SEARCHSPACE-STOP
+-- TAG-SEARCHSPACEID-START
+
+SearchSpaceId ::= 							INTEGER (0..maxNrofSearchSpaces-1)
+
+-- TAG-SEARCHSPACEID-STOP
+-- TAG-SECURITY-ALGORITHM-CONFIG-START
+
+SecurityAlgorithmConfig ::=			SEQUENCE {
+	cipheringAlgorithm					CipheringAlgorithm,
+	integrityProtAlgorithm				IntegrityProtAlgorithm			OPTIONAL,	-- Need R	
+	...
+}
+
+IntegrityProtAlgorithm ::=			ENUMERATED {
+											nia0, nia1, nia2, nia3, spare4, spare3,
+											spare2, spare1, ...}
+
+CipheringAlgorithm ::=				ENUMERATED {
+											nea0, nea1, nea2, nea3, spare4, spare3,
+											spare2, spare1, ...}
+
+-- TAG-SECURITY-ALGORITHM-CONFIG-STOP
+-- TAG-SERV-CELL-INDEX-START
+
+ServCellIndex ::=					INTEGER (0..maxNrofServingCells-1)
+
+-- TAG-SERV-CELL-INDEX-STOP
+-- TAG-SERVING-CELL-CONFIG-START
+
+ServingCellConfig ::=		SEQUENCE {
+	-- L1 parameters:
+
+	tdd-UL-DL-ConfigurationDedicated	TDD-UL-DL-ConfigDedicated												OPTIONAL, -- Cond TDD
+
+	-- The dedicated (UE-specific) configuration for the initial downlink bandwidth-part.
+	initialDownlinkBWP					BWP-DownlinkDedicated													OPTIONAL,	-- Cond ServCellAdd
+
+	-- List of additional downlink bandwidth parts to be released. (see 38.211, 38.213, section 12). 
+	downlinkBWP-ToReleaseList			SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Id								OPTIONAL,	-- Need N
+	-- List of additional downlink bandwidth parts to be added or modified. (see 38.211, 38.213, section 12). 
+	downlinkBWP-ToAddModList			SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Downlink						OPTIONAL, 	-- Need N
+
+	-- If configured for an SpCell, this field contains the ID of the DL BWP to be activated upon performing the reconfiguration 
+	-- in which it is received. If the field is absent, the RRC reconfiguration does not impose a BWP switch (corresponds to L1 
+	-- parameter 'active-BWP-DL-Pcell'). 
+	-- If configured for an SCell, this field contains the ID of the downlink bandwidth part to be used upon MAC-activation of an  SCell. 
+	-- If not provided, the UE uses the default BWP.
+	-- The initial bandwidth part is referred to by BWP-Id = 0.
+	firstActiveDownlinkBWP-Id			BWP-Id																	OPTIONAL,	-- Need R
+
+	-- The duration in ms after which the UE falls back to the default Bandwidth Part. (see 38.321, section 5.15) 
+	-- The value 0.5 ms is only applicable for carriers >6 GHz. 
+	-- When the network releases the timer configuration, the UE stops the timer without swithching to the default BWP.
+	bwp-InactivityTimer					ENUMERATED {ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30, ms40,ms50, ms60, ms80,
+													ms100, ms200, ms300, ms500, ms750, ms1280, ms1920, ms2560, spare10, spare9, 
+													spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 } OPTIONAL,	--	Need R	
+
+	-- Corresponds to L1 parameter 'default-DL-BWP'. The initial bandwidth part is referred to by BWP-Id = 0.
+	-- ID of the downlink bandwidth part to be used upon expiry of txxx.
+	-- This field is UE specific. When the field is absent the UE uses the the initial BWP as default BWP.
+	-- (see 38.211, 38.213, section 12 and 38.321, section 5.15)
+	defaultDownlinkBWP-Id				BWP-Id																	OPTIONAL, 	-- Need M
+
+	uplinkConfig						UplinkConfig															OPTIONAL,	-- Cond ServCellAdd-UL
+	supplementaryUplink					UplinkConfig 															OPTIONAL, 	-- Cond ServCellAdd-SUL
+
+
+	-- PDSCH releated parameters that are not BWP-specific.
+	pdsch-ServingCellConfig				SetupRelease { PDSCH-ServingCellConfig }								OPTIONAL,	-- Need M
+	csi-MeasConfig						SetupRelease { CSI-MeasConfig }											OPTIONAL,	-- Need M
+	
+	-- Includes parameters for configuration of carrier based SRS switching
+	-- Corresponds to L1 parameter 'SRS-CarrierSwitching' (see 38,214, section FFS_Section)
+	carrierSwitching					SetupRelease { SRS-CarrierSwitching	}									OPTIONAL,	-- Need M
+	-- MAC parameters:
+	sCellDeactivationTimer				ENUMERATED {ms20, ms40, ms80, ms160, ms200, ms240, ms320, ms400, ms480, ms520, ms640, 
+												ms720, ms840, ms1280, spare2,spare1}				OPTIONAL,	-- Cond ServingCellWithoutPUCCH
+
+	-- Indicates whether this SCell is cross-carrier scheduled by another serving cell.
+	crossCarrierSchedulingConfig		CrossCarrierSchedulingConfig											OPTIONAL,	-- Need M
+
+	-- Timing Advance Group ID, as specified in TS 38.321 [3],  which this cell belongs to. 
+	tag-Id								TAG-Id,
+	-- Enables the "UE beam lock function (UBF)", which disable changes to the UE beamforming configuration when in NR_RRC_CONNECTED.
+	-- FFS: Parameter added preliminary based on RAN4 LS in R4-1711823. Decide where to place it (maybe ServingCellConfigCommon or 
+	-- in a BeamManagement IE??)
+	ue-BeamLockFunction					ENUMERATED {enabled}													OPTIONAL,	-- Need R
+
+	-- Indicates whether UE shall apply as pathloss reference either the downlink of PCell or of SCell that corresponds with this uplink
+	-- (see 38.213, section 7)
+	pathlossReferenceLinking			ENUMERATED {pCell, sCell}												OPTIONAL		-- Cond SCellOnly
+}
+
+UplinkConfig ::=					SEQUENCE {
+	-- Configuration of UL BWPs (including BWP-specific parameters:
+
+	-- The dedicated (UE-specific) configuration for the initial uplink bandwidth-part.
+	initialUplinkBWP					BWP-UplinkDedicated														OPTIONAL, 	-- Cond ServCellAdd
+
+	-- The additional bandwidth parts for uplink. In case of TDD uplink- and downlink BWP with the same bandwidthPartId are considered 
+	-- as a BWP pair and must have the same center frequency. 
+	uplinkBWP-ToReleaseList				SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Id								OPTIONAL,	-- Need N
+	uplinkBWP-ToAddModList				SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Uplink							OPTIONAL, 	-- Need N
+
+	-- If configured for an SpCell, this field contains the ID of the DL BWP to be activated upon performing the reconfiguration 
+	-- in which it is received. If the field is absent, the RRC reconfiguration does not impose a BWP switch (corresponds to 
+	-- L1 parameter 'active-BWP-UL-Pcell').
+	-- If configured for an SCell, this field contains the ID of the uplink bandwidth part to be used upon MAC-activation of an  SCell. 
+	-- If not provided, the UE uses the FFS: default BWP.
+	-- The initial bandwidth part is referred to by BandiwdthPartId = 0.
+	firstActiveUplinkBWP-Id				BWP-Id																	OPTIONAL,	-- Need R
+
+	-- Configuration that is common across the UL BWPs:
+
+	-- PUSCH related parameters that are not BWP-specific.
+	pusch-ServingCellConfig				SetupRelease { PUSCH-ServingCellConfig }								OPTIONAL,	-- Need M
+	...
+}
+
+-- TAG-SERVING-CELL-CONFIG-STOP
+-- TAG-SERVING-CELL-CONFIG-COMMON-START
+
+ServingCellConfigCommon ::=		SEQUENCE {
+	physCellId							PhysCellId													OPTIONAL, -- Cond HOAndServCellAdd,
+	frequencyInfoDL						FrequencyInfoDL												OPTIONAL, -- Cond InterFreqHOAndServCellAdd
+	-- The initial downlink BWP configuration for a SpCell (PCell of MCG or SCG). 
+	initialDownlinkBWP					BWP-DownlinkCommon											OPTIONAL,	-- Cond ServCellAdd
+
+	uplinkConfigCommon					UplinkConfigCommon											OPTIONAL, -- Cond ServCellAdd-UL 
+	supplementaryUplinkConfig					UplinkConfigCommon									OPTIONAL, -- Cond ServCellAdd-SUL
+
+
+	-- Indicates the time domain positions of the transmitted SS-blocks in an SS-burst. The first/ leftmost bit corresponds to SS/PBCH 
+	-- block index 0, the second bit corresponds to SS/PBCH block index 1, and so on. Value 0 in the bitmap indicates that the 
+	-- corresponding SS/PBCH block is not transmitted while value 1 indicates that the corresponding SS/PBCH block is transmitted.
+	-- Corresponds to L1 parameter 'SSB-Transmitted' (see 38.213, section 4.1)
+	ssb-PositionsInBurst				CHOICE {
+		-- bitmap for sub 3 GHz
+		shortBitmap							BIT STRING (SIZE (4)),
+		-- bitmap for 3-6 GHz
+		mediumBitmap						BIT STRING (SIZE (8)),
+		-- bitmap for above 6 GHz
+		longBitmap							BIT STRING (SIZE (64))
+	}																								OPTIONAL, -- Need R,
+	-- The SSB periodicity in msec for the rate matching purpose. If the field is absent, the UE applies the value ms5.
+	-- (see 38.211, section [7.4.3.1])
+	ssb-periodicityServingCell			ENUMERATED { ms5, ms10, ms20, ms40, ms80, ms160, spare2, spare1 }			OPTIONAL,	-- Need S
+	-- Position of (first) DL DM-RS (see 38.211, section 7.4.1.1.1)
+	dmrs-TypeA-Position					ENUMERATED {pos2, pos3},
+
+	-- Parameters to determine an LTE CRS pattern that the UE shall rate match around.
+	lte-CRS-ToMatchAround					SetupRelease { RateMatchPatternLTE-CRS } 				OPTIONAL,	-- Need M
+
+	-- Resources patterns which the UE should rate match PDSCH around. The UE rate matches around the union of all resources 
+	-- indicated in the nested bitmaps. Rate match patterns defined here on cell level apply only to PDSCH of the same numerology.
+	-- Corresponds to L1 parameter 'Resource-set-cekk' (see 38.214, section 5.1.2.2.3)
+	rateMatchPatternToAddModList			SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPattern		OPTIONAL, -- Need N
+	rateMatchPatternToReleaseList			SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId		OPTIONAL, -- Need N
+
+	-- Subcarrier spacing of SSB. Used only for non-initial access (e.g. SCells, PCell of SCG).
+	-- If the field is absent the UE shall assume the default value of the band. 
+	-- Only the values 15 or 30 kHz (<6GHz), 120 or 240 kHz (>6GHz) are applicable.
+	subcarrierSpacing				SubcarrierSpacing												OPTIONAL, -- Need S
+	-- A cell-specific TDD UL/DL configuration. Corresponds to L1 parameter 'UL-DL-configuration-common' (see 38.213, section 11.1)
+	tdd-UL-DL-ConfigurationCommon		TDD-UL-DL-ConfigCommon										OPTIONAL, -- Cond TDD
+	-- A second cell-specific TDD UL/DL configuration. When tdd-UL-DL-ConfigurationCommon2 is configured, the cell specific DL/UL 
+	-- pattern is a concatenation of the pattern specified in tdd-UL-DL-ConfigurationCommon and the pattern specified in 
+	-- tdd-UL-DL-ConfigurationCommon2. Corresponds to L1 parameter 'UL-DL-configuration-common-Set2' (see 38.211, section 11.1)
+	tdd-UL-DL-ConfigurationCommon2		TDD-UL-DL-ConfigCommon										OPTIONAL, -- Cond TDD
+	-- TX power that the NW used for SSB transmission. The UE uses it to estimate the RA preamble TX power. 
+	-- (see 38.213, section 7.4)
+	ss-PBCH-BlockPower					INTEGER (-60..50),
+	...
+}
+
+UplinkConfigCommon ::=				SEQUENCE {
+	-- Absolute uplink frequency configuration and subcarrier specific virtual carriers.
+	frequencyInfoUL						FrequencyInfoUL												OPTIONAL, -- Cond InterFreqHOAndServCellAdd
+	-- The initial uplink BWP configuration for a SpCell (PCell of MCG or SCG). Corresponds to L1 parameter 'initial-UL-BWP'. 
+	-- (see 38.331, section FFS_Section).
+	initialUplinkBWP			BWP-UplinkCommon													OPTIONAL	-- Cond ServCellAdd
+}
+
+-- TAG-SERVING-CELL-CONFIG-COMMON-STOP 
+-- TAG-SINR-RANGE-START
+
+SINR-Range ::=						INTEGER(0..127)
+
+-- TAG-SINR-RANGE-STOP
+-- TAG-SLOTFORMATCOMBINATIONSPERCELL-START
+
+-- The SlotFormatCombinations applicable for one serving cell. Corresponds to L1 parameter 'cell-to-SFI' (see 38.213, section 11.1.1)
+SlotFormatCombinationsPerCell ::=								SEQUENCE {
+	-- The ID of the serving cell for which the slotFormatCombinations are applicable
+	servingCellId								ServCellIndex,
+
+	-- Reference subcarrier spacing for this Slot Format Combination. Corresponds to L1 parameter 'SFI-scs' (see 38.213, section FFS_Section)
+	subcarrierSpacing							SubcarrierSpacing,
+	-- Reference subcarrier spacing for a Slot Format Combination on an FDD or SUL cell. 
+	-- Corresponds to L1 parameter 'SFI-scs2' (see 38.213, section FFS_Section).
+	-- For FDD, subcarrierSpacing (SFI-scs) is the reference SCS for DL BWP and subcarrierSpacing2 (SFI-scs2) is the reference SCS for UL BWP.
+	-- For SUL, subcarrierSpacing (SFI-scs) is the reference SCS for non-SUL carrier and subcarrierSpacing2 (SFI-scs2) is the reference 
+	-- SCS for SUL carrier. 
+	subcarrierSpacing2							SubcarrierSpacing															OPTIONAL,	-- Need R
+
+	-- A list with SlotFormatCombinations. Each SlotFormatCombination comprises of one or more SlotFormats (see 38.211, section 4.3.2)
+	-- FFS_CHECK: RAN1 indicates that the combinations could be of two different types... but they don't specify the second
+	slotFormatCombinations						SEQUENCE (SIZE (1..maxNrofSlotFormatCombinationsPerSet)) OF SlotFormatCombination	OPTIONAL,
+
+	-- The (starting) position (bit) of the slotFormatCombinationId (SFI-Index) for this serving cell (servingCellId) within the DCI payload. 
+	-- Corresponds to L1 parameter 'SFI-values' (see 38.213, section FFS_Section)
+	positionInDCI							INTEGER(0..maxSFI-DCI-PayloadSize-1)													OPTIONAL,
+	...
+}
+
+SlotFormatCombination ::= 					SEQUENCE {
+	-- This ID is used in the DCI payload to dynamically select this SlotFormatCombination.
+	-- Corresponds to L1 parameter 'SFI-index' (see 38.213, section FFS_Section)
+	slotFormatCombinationId						SlotFormatCombinationId,
+	-- Slot formats that occur in consecutive slots in time domain order as listed here. The the slot formats are 
+	-- defined in 38.211, table 4.3.2-3 and numbered with 0..255.
+	slotFormats									SEQUENCE (SIZE (1..maxNrofSlotFormatsPerCombination)) OF INTEGER (0..255)
+}
+
+-- SFI index that is assoicated with a certian slot-format-combination
+-- Corresponds to L1 parameter 'SFI-index' (see 38.213, section FFS_Section)
+SlotFormatCombinationId	::=					INTEGER (0..maxNrofSlotFormatCombinationsPerSet-1)
+
+-- TAG-SLOTFORMATCOMBINATIONSPERCELL-STOP
+-- TAG-SLOTFORMATINDICATOR-START
+
+SlotFormatIndicator ::= 		SEQUENCE {
+	-- RNTI used for SFI on the given cell
+	-- Corresponds to L1 parameter 'SFI-RNTI' (see 38.213, section 11.1.1)
+	sfi-RNTI						RNTI-Value,
+
+	-- Total length of the DCI payload scrambled with SFI-RNTI. 
+	-- Corresponds to L1 parameter 'SFI-DCI-payload-length' (see 38.213, section 11.1.1)
+	dci-PayloadSize					INTEGER (1..maxSFI-DCI-PayloadSize),
+
+	-- A list of SlotFormatCombinations for the UE's serving cells.
+	-- Corresponds to L1 parameter 'SFI-cell-to-SFI' (see 38.213, section 11.1.1)
+	slotFormatCombToAddModList		SEQUENCE (SIZE(1..maxNrofAggregatedCellsPerCellGroup)) OF SlotFormatCombinationsPerCell	OPTIONAL,	-- Need N
+	slotFormatCombToReleaseList		SEQUENCE (SIZE(1..maxNrofAggregatedCellsPerCellGroup)) OF ServCellIndex					OPTIONAL,	-- Need N
+	...
+}
+
+-- TAG-SLOTFORMATINDICATOR-STOP
+-- TAG-SPS-CONFIG-START
+
+-- Downlink SPS may be configured on the PCell as well as on SCells. But it shall not be configured for more than
+-- one serving cell of a cell group at once.
+SPS-Config ::= 							SEQUENCE {
+	-- Periodicity for DL SPS
+	-- Corresponds to L1 parameter 'semiPersistSchedIntervalDL' (see 38.214 and 38.321, section FFS_Section)
+	-- FFS-Value: Support also shorter periodicities for DL?
+	periodicity								ENUMERATED {ms10, ms20, ms32, ms40, ms64, ms80, ms128, ms160, ms320, ms640,
+														spare6, spare5, spare4, spare3, spare2, spare1},
+	-- Number of configured HARQ processes for SPS DL. Corresponds to L1 parameter 'numberOfConfSPS-Processes' (see 38.214, section FFS_Section)
+	nrofHARQ-Processes						INTEGER (1..8),
+	-- HARQ resource for PUCCH for DL SPS. The network configures the resource either as format0 or format1. (see 38.214, section FFS_Section)
+	n1PUCCH-AN									PUCCH-Resource																OPTIONAL	-- Need M
+}
+
+-- TAG-SPS-CONFIG-STOP
+-- TAG-SRB-IDENTITY-START
+
+SRB-Identity ::=					INTEGER (1..3)
+
+-- TAG-SRB-IDENTITY-STOP
+-- TAG-SRS-CONFIG-START
+
+SRS-Config ::= 							SEQUENCE {
+	srs-ResourceSetToReleaseList 			SEQUENCE (SIZE(0..maxNrofSRS-ResourceSets)) OF SRS-ResourceSetId			OPTIONAL, 	-- Need N
+	srs-ResourceSetToAddModList 			SEQUENCE (SIZE(0..maxNrofSRS-ResourceSets)) OF SRS-ResourceSet				OPTIONAL, 	-- Need N
+
+	srs-ResourceToReleaseList 	 			SEQUENCE (SIZE(1..maxNrofSRS-Resources)) OF SRS-ResourceId					OPTIONAL,	-- Need N
+	srs-ResourceToAddModList 	 			SEQUENCE (SIZE(1..maxNrofSRS-Resources)) OF SRS-Resource					OPTIONAL, 	-- Need N
+
+
+	-- If absent, UE applies TPC commands via accumulation. If disabled, UE applies the TPC command without accumulation 
+	-- (this applies to SRS when a separate closed loop is configured for SRS)
+	-- Corresponds to L1 parameter 'Accumulation-enabled-srs' (see 38,213, section 7.3)
+	tpc-Accumulation							ENUMERATED {disabled}													OPTIONAL,	-- Need S
+	...
+}
+
+SRS-ResourceSet ::= 					SEQUENCE {
+	-- The ID of this resource set. It is unique in the context of the BWP in which the parent SRS-Config is defined.
+	srs-ResourceSetId						SRS-ResourceSetId,
+	-- The IDs of the SRS-Reosurces used in this SRS-ResourceSet
+	srs-ResourceIdList						SEQUENCE (SIZE(1..maxNrofSRS-ResourcesPerSet)) OF SRS-ResourceId		OPTIONAL,	-- Cond Setup
+
+	resourceType							CHOICE {
+		aperiodic								SEQUENCE {
+			-- The DCI "code point" upon which the UE shall transmit SRS according to this SRS resource set configuration.
+			-- Corresponds to L1 parameter 'AperiodicSRS-ResourceTrigger' (see 38.214, section 6.1.1.2)
+			aperiodicSRS-ResourceTrigger			INTEGER (0..maxNrofSRS-TriggerStates-1),
+			-- ID of CSI-RS resource associated with this SRS resource set. (see 38.214, section 6.1.1.2)
+			csi-RS									NZP-CSI-RS-ResourceId,
+			-- An offset in number of slots between the triggering DCI and the actual transmission of this SRS-ResourceSet.
+			-- If the field is absent the UE applies no offset (value 0)
+			slotOffset								INTEGER (1..8)													OPTIONAL,	-- Need S
+			...
+		},
+		semi-persistent							SEQUENCE {
+			-- ID of CSI-RS resource associated with this SRS resource set in non-codebook based operation.
+			-- Corresponds to L1 parameter 'SRS-AssocCSIRS' (see 38.214, section 6.2.1)
+			associatedCSI-RS		NZP-CSI-RS-ResourceId															OPTIONAL, -- Cond nonCodebook
+			...
+		},
+		periodic								SEQUENCE {
+			-- ID of CSI-RS resource associated with this SRS resource set in non-codebook based operation.
+			-- Corresponds to L1 parameter 'SRS-AssocCSIRS' (see 38.214, section 6.2.1)
+			associatedCSI-RS		NZP-CSI-RS-ResourceId															OPTIONAL, -- Cond nonCodebook
+			...
+		}
+	},
+	-- Indicates if the SRS resource set is used for beam management vs. used for either codebook based or non-codebook based transmission.
+	-- Corresponds to L1 parameter 'SRS-SetUse' (see 38.214, section 6.2.1)
+	-- FFS_CHECK: Isn't codebook/noncodebook already known from the ulTxConfig in the SRS-Config? If so, isn't the only distinction 
+	-- in the set between BeamManagement, AtennaSwitching and "Other”? Or what happens if SRS-Config=Codebook but a Set=NonCodebook?
+	usage									ENUMERATED {beamManagement, codebook, nonCodebook, antennaSwitching},
+
+	-- alpha value for SRS power control. Corresponds to L1 parameter 'alpha-srs' (see 38.213, section 7.3)
+	-- When the field is absent the UE applies the value 1
+	alpha									Alpha																		OPTIONAL, -- Need S
+	-- P0 value for SRS power control. The value is in dBm. Only even values (step size 2) are allowed.
+	-- Corresponds to L1 parameter 'p0-srs' (see 38.213, section 7.3)
+	p0										INTEGER (-202..24)															OPTIONAL, -- Cond Setup
+	-- A reference signal (e.g. a CSI-RS config or a SSblock) to be used for SRS path loss estimation. 
+	-- Corresponds to L1 parameter 'srs-pathlossReference-rs-config' (see 38.213, section 7.3)
+	pathlossReferenceRS						CHOICE {
+		ssb-Index								SSB-Index,
+		csi-RS-Index							NZP-CSI-RS-ResourceId
+	}																													OPTIONAL, -- Need M
+	-- Indicates whether hsrs,c(i) = fc(i,1) or hsrs,c(i) = fc(i,2) (if twoPUSCH-PC-AdjustmentStates are configured) 
+	-- or serarate close loop is configured for SRS. This parameter is applicable only for Uls on which UE also transmits PUSCH.
+	-- If absent or release, the UE applies the value sameAs-Fci1
+	-- Corresponds to L1 parameter 'srs-pcadjustment-state-config' (see 38.213, section 7.3)
+	srs-PowerControlAdjustmentStates		ENUMERATED { sameAsFci2, separateClosedLoop}					OPTIONAL, -- Need S
+	...
+}
+
+SRS-ResourceSetId ::= 					INTEGER (0..maxNrofSRS-ResourceSets-1)
+
+SRS-Resource ::= 						SEQUENCE {
+	srs-ResourceId							SRS-ResourceId,
+	nrofSRS-Ports							ENUMERATED {port1, ports2, ports4},
+	-- The PTRS port index for this SRS resource for non-codebook based UL MIMO. This is only applicable when the corresponding 
+	-- PTRS-UplinkConfig is set to CP-OFDM. The ptrs-PortIndex configured here must be smaller than or equal to the maxNnrofPorts  
+	-- configured in the PTRS-UplinkConfig.
+	-- Corresponds to L1 parameter 'UL-PTRS-SRS-mapping-non-CB' (see 38.214, section 6.1)
+	ptrs-PortIndex							ENUMERATED {n0, n1 }														OPTIONAL,	-- Need R  
+	-- Comb value (2 or 4) and comb offset (0..combValue-1). Corresponds to L1 parameter 'SRS-TransmissionComb' (see 38.214, section 6.2.1)
+	transmissionComb						CHOICE {
+		n2										SEQUENCE {
+			combOffset-n2							INTEGER (0..1),
+			-- Cyclic shift configuration. Corresponds to L1 parameter 'SRS-CyclicShiftConfig' (see 38.214, section 6.2.1)
+			cyclicShift-n2							INTEGER (0..7)
+		}, 
+		n4										SEQUENCE {
+			combOffset-n4							INTEGER (0..3),
+			-- Cyclic shift configuration. Corresponds to L1 parameter 'SRS-CyclicShiftConfig' (see 38.214, section 6.2.1)
+			cyclicShift-n4							INTEGER (0..11)
+		}
+	},
+	-- OFDM symbol location of the SRS resource within a slot including number of OFDM symbols (N = 1, 2 or 4 per SRS resource),
+	-- startPosition (SRSSymbolStartPosition = 0..5; "0" refers to the last symbol, "1" refers to the second last symbol) and 
+	-- RepetitionFactor (r = 1, 2 or 4).	
+	-- Corresponds to L1 parameter 'SRS-ResourceMapping' (see 38.214, section 6.2.1 and 38.211, section 6.4.1.4). 
+	-- FFS: Apparently, RAN1 considers replacing these three fields by a table in RAN1 specs and a corresponding index in ASN.1?!
+	resourceMapping							SEQUENCE {
+		startPosition							INTEGER (0..5),
+		nrofSymbols								ENUMERATED {n1, n2, n4},
+		repetitionFactor						ENUMERATED {n1, n2, n4}
+	},
+	-- Parameter(s) defining frequency domain position and configurable shift to align SRS allocation to 4 PRB grid.
+	-- Corresponds to L1 parameter 'SRS-FreqDomainPosition' (see 38.214, section 6.2.1)
+	freqDomainPosition						INTEGER (0..67),
+	freqDomainShift							INTEGER (0..268), 
+	-- Includes  parameters capturing SRS frequency hopping 
+	-- Corresponds to L1 parameter 'SRS-FreqHopping' (see 38.214, section 6.2.1)
+	freqHopping								SEQUENCE {
+		c-SRS									INTEGER (0..63),
+		b-SRS									INTEGER (0..3), 
+		b-hop									INTEGER (0..3)
+	},
+	-- Parameter(s) for configuring group or sequence hopping
+	-- Corresponds to L1 parameter 'SRS-GroupSequenceHopping' (see 38.211, section FFS_Section)
+	groupOrSequenceHopping					ENUMERATED { neither, groupHopping, sequenceHopping },
+	-- Time domain behavior of SRS resource configuration.  
+	-- Corresponds to L1 parameter 'SRS-ResourceConfigType' (see 38.214, section 6.2.1).
+	-- For codebook based uplink transmission, the network configures SRS resources in the same resource set with the same 
+	-- time domain behavior on periodic, aperiodic and semi-persistent SRS.
+	-- FFS: Add configuration parameters for the different SRS resource types?
+	resourceType							CHOICE {
+		aperiodic								SEQUENCE {
+			...
+		}, 
+		semi-persistent							SEQUENCE {
+			-- Periodicity and slot offset for for this SRS resource. All values in "number of slots".
+			-- sl1 corresponds to a periodicity of 1 slot, value sl2 corresponds to a periodicity of 2 slots, and so on. 
+			-- For each periodicity the corresponding offset is given in number of slots. For periodicity sl1 the offset is 0 slots.   
+			-- Corresponds to L1 parameter 'SRS-SlotConfig' (see 38.214, section 6.2.1)
+			periodicityAndOffset-sp						SRS-PeriodicityAndOffset,
+			...
+		},
+		periodic								SEQUENCE {
+			-- Periodicity and slot offset for for this SRS resource. All values in "number of slots" 
+			-- sl1 corresponds to a periodicity of 1 slot, value sl2 corresponds to a periodicity of 2 slots, and so on. 
+			-- For each periodicity the corresponding offset is given in number of slots. For periodicity sl1 the offset is 0 slots.   
+			-- Corresponds to L1 parameter 'SRS-SlotConfig' (see 38.214, section 6.2.1)
+			periodicityAndOffset-p						SRS-PeriodicityAndOffset,
+			...
+		}
+	},
+	-- Sequence ID used to initialize psedo random group and sequence hopping. 
+	-- Corresponds to L1 parameter 'SRS-SequenceId' (see 38.214, section 6.2.1)
+	sequenceId								BIT STRING (SIZE (10)),
+
+	-- Configuration of the spatial relation between a reference RS and the target SRS. Reference RS can be SSB/CSI-RS/SRS
+	-- Corresponds to L1 parameter 'SRS-SpatialRelationInfo' (see 38.214, section 6.2.1)
+	spatialRelationInfo						CHOICE {
+		ssb-Index								SSB-Index,
+		csi-RS-Index									NZP-CSI-RS-ResourceId,
+		srs										SRS-ResourceId
+	}																													OPTIONAL,	-- Need R
+	...
+}
+
+SRS-ResourceId ::= 						INTEGER (0..maxNrofSRS-Resources-1)
+
+SRS-PeriodicityAndOffset ::=			CHOICE {
+	sl1										NULL, 
+	sl2										INTEGER(0..1), 
+	sl4										INTEGER(0..3), 
+	sl5										INTEGER(0..4), 
+	sl8										INTEGER(0..7), 
+	sl10									INTEGER(0..9), 
+	sl16									INTEGER(0..15), 
+	sl20									INTEGER(0..19), 
+	sl32									INTEGER(0..31), 
+	sl40									INTEGER(0..39), 
+	sl64									INTEGER(0..63), 
+	sl80									INTEGER(0..79), 
+	sl160									INTEGER(0..159), 
+	sl320									INTEGER(0..319),
+	sl640									INTEGER(0..639),
+	sl1280									INTEGER(0..1279),
+	sl2560									INTEGER(0..2559)
+}
+
+-- TAG-SRS-CONFIG-STOP
+-- TAG-SRS-CARRIERSWITCHING-START
+SRS-CarrierSwitching ::=				SEQUENCE {
+
+	-- Indicates the serving cell whose UL transmission may be interrupted during SRS transmission on a PUSCH-less cell. 
+	-- During SRS transmission on a PUSCH-less cell, the UE may temporarily suspend the UL transmission on a serving cell with PUSCH 
+	-- in the same CG to allow the PUSCH-less cell to transmit SRS. (see 38.214, section 6.2.1.3)
+	srs-SwitchFromServCellIndex				INTEGER (0..31)																OPTIONAL,	-- Cond Setup
+
+	-- Network configures the UE with either typeA-SRS-TPC-PDCCH-Group or typeB-SRS-TPC-PDCCH-Group, if any.
+	srs-TPC-PDCCH-Group					CHOICE {
+		-- Type A trigger configuration for SRS transmission on a PUSCH-less SCell. 
+		-- Corresponds to L1 parameter 'typeA-SRS-TPC-PDCCH-Group' (see 38.212, 38.213, section 7.3.1, 11.3)
+		typeA								SEQUENCE (SIZE (1..32)) OF SRS-TPC-PDCCH-Config,
+		-- Type B trigger configuration for SRS transmission on a PUSCH-less SCell. 
+		-- Corresponds to L1 parameter 'typeB-SRS-TPC-PDCCH-Config' (see 38.212, 38.213, section 7.3.1, 11.3)
+		typeB								SRS-TPC-PDCCH-Config
+	}																													OPTIONAL, 	-- Cond Setup
+
+	-- Maps a specific cell to a given SFI value within the DCI message
+	-- Corresponds to L1 parameter 'SRS-cell-to-SFI' (see 38.212, 38.213, section 7.3.1, 11.3)
+	srs-CellToSFI						SEQUENCE (SIZE (1..maxNrofServingCells)) OF SlotFormatCombinationsPerCell			OPTIONAL, 	-- Cond Setup
+	
+	-- A set of serving cells for monitoring PDCCH conveying SRS DCI format with CRC scrambled by TPC-SRS-RNTI
+	-- Corresponds to L1 parameter 'SRS-monitoring-cells' (see 38.212, 38.213, section 7.3.1, 11.3)
+	monitoringCells		SEQUENCE (SIZE (1..maxNrofServingCells)) OF ServCellIndex						OPTIONAL,	-- Cond Setup
+	...
+}
+
+-- One trigger configuration for SRS-Carrier Switching. (see 38.212, 38.213, section 7.3.1, 11.3)
+SRS-TPC-PDCCH-Config ::=				SEQUENCE {
+	-- The starting bit position of a block within the group DCI with SRS request fields (optional) and TPC commands 
+	-- for a PUSCH-less SCell. (see 38.212, 38.213, section 7.3.1, 11.3)
+	startingBitOfFormat2-3					INTEGER (1..31)																OPTIONAL, 	-- Cond Setup
+	-- The type of a field within the group DCI with SRS request fields (optional) for a PUSCH-less SCell, 
+	-- which indicates how many bits in the field are for SRS request (0 or 1/2). 
+	-- Note that for Type A, there is a common SRS request field for all SCells in the set, but each SCell has its 
+	-- own TPC command bits. See TS 38.212. Network configures this field with the same value for all PUSCH-less SCells.
+	-- (see 38.212, 38.213, section 7.3.1, 11.3)
+	fieldTypeFormat2-3						INTEGER (0..1)																OPTIONAL, 	-- Cond Setup
+	-- A list of paris of [cc-SetIndex; cc-IndexInOneCC-Set] (see 38.212, 38.213, section 7.3.1, 11.3)
+	-- FFS: Improve description. What is a "CC"? Where is a CC-Set defined? ...
+	srs-CC-SetIndexlist						SEQUENCE (SIZE(1..4)) OF SRS-CC-SetIndex 									OPTIONAL	-- Cond Setup
+}
+
+SRS-CC-SetIndex ::=						SEQUENCE {
+	-- Indicates the CC set index for Type A associated (see 38.212, 38.213, section 7.3.1, 11.3)
+	cc-SetIndex								INTEGER (0..3)															OPTIONAL, 	-- Cond Setup
+	-- Indicates the CC index in one CC set for Type A (see 38.212, 38.213, section 7.3.1, 11.3)
+	cc-IndexInOneCC-Set						INTEGER (0..7)															OPTIONAL		-- Cond Setup
+}
+
+-- TAG-SRS-CARRIERSWITCHING-STOP
+-- TAG-SSB-INDEX-START
+
+SSB-Index ::=								INTEGER (0..63)
+
+-- TAG-SSB-INDEX-STOP
+-- TAG-SUBCARRIER-SPACING-START
+
+-- The subcarrier spacing supported in NR. Restrictions applicable for certain frequencies, channels or signals are clarified 
+-- in the fields that use this IE.
+SubcarrierSpacing ::= 					ENUMERATED {kHz15, kHz30, kHz60, kHz120, kHz240, spare3, spare2, spare1}
+
+
+-- TAG-SUBCARRIER-SPACING-STOP
+-- TAG-TCI-STATE-START
+
+TCI-State ::= 				SEQUENCE {
+	tci-StateId					TCI-StateId,
+	qcl-Type1					QCL-Info,
+	qcl-Type2					QCL-Info																					OPTIONAL,	-- Need R
+	nrofPTRS-Ports				ENUMERATED {n1, n2}																			OPTIONAL,	-- Need R
+	...
+}
+
+QCL-Info ::=				SEQUENCE {
+
+	-- The carrier which the RS is located in. If the field is absent, it applies to the serving cell in which the TCI-State is configured
+	cell						ServCellIndex																				OPTIONAL,	-- Need R
+
+	-- The DL BWP which the RS is located in. 
+	bwp-Id						BWP-Id			OPTIONAL, -- Cond CSI-RS-Indicated
+	-- Cond NZP-CSI-RS-Indicated: mandatory if csi-rs or csi-RS-for-tracking is included, absent otherwise
+	referenceSignal				CHOICE {
+		csi-rs						NZP-CSI-RS-ResourceId,
+		ssb							SSB-Index,
+		-- A set of CSI-RS resources for tracking
+		csi-RS-for-tracking			NZP-CSI-RS-ResourceSetId
+	},
+	qcl-Type					ENUMERATED {typeA, typeB, typeC, typeD},
+	...
+}
+
+-- TAG-TCI-STATE-STOP
+-- TAG-TCI-STATEID-START
+
+TCI-StateId ::=				INTEGER (0..maxNrofTCI-States-1)
+
+-- TAG-TCI-STATEID-STOP
+-- TAG-TDD-UL-DL-CONFIG-START
+
+TDD-UL-DL-ConfigCommon ::=			SEQUENCE {
+	-- Reference SCS used to determine the time domain boundaries in the UL-DL pattern which must be common across all subcarrier specific
+	-- virtual carriers, i.e., independent of the actual subcarrier spacing using for data transmission. 
+	-- Only the values 15 or 30 kHz  (<6GHz), 60 or 120 kHz (>6GHz) are applicable.
+	-- Corresponds to L1 parameter 'reference-SCS' (see 38.211, section FFS_Section)
+	referenceSubcarrierSpacing			SubcarrierSpacing																	OPTIONAL,
+	-- Periodicity of the DL-UL pattern. Corresponds to L1 parameter 'DL-UL-transmission-periodicity' (see 38.211, section FFS_Section)
+	dl-UL-TransmissionPeriodicity		ENUMERATED {ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms5, ms10}						OPTIONAL,
+
+	-- Number of consecutive full DL slots at the beginning of each DL-UL pattern. 
+	-- Corresponds to L1 parameter 'number-of-DL-slots' (see 38.211, Table 4.3.2-1)
+	nrofDownlinkSlots					INTEGER (0..maxNrofSlots)																	OPTIONAL,
+
+	-- Number of consecutive DL symbols in the beginning of the slot following the last full DL slot (as derived from nrofDownlinkSlots). 
+	-- If the field is absent or released, there is no partial-downlink slot.
+	-- Corresponds to L1 parameter 'number-of-DL-symbols-common' (see 38.211, section FFS_Section).
+	nrofDownlinkSymbols					INTEGER (0..maxNrofSymbols-1)															OPTIONAL,	-- Need R
+	
+	-- Number of consecutive full UL slots at the end of each DL-UL pattern. 
+	-- Corresponds to L1 parameter 'number-of-UL-slots' (see 38.211, Table 4.3.2-1)
+	nrofUplinkSlots						INTEGER (0..maxNrofSlots)																	OPTIONAL,
+	
+	-- Number of consecutive UL symbols in the end of the slot preceding the first full UL slot (as derived from nrofUplinkSlots).
+	-- If the field is absent or released, there is no partial-uplink slot.
+	-- Corresponds to L1 parameter 'number-of-UL-symbols-common' (see 38.211, section FFS_Section)
+	nrofUplinkSymbols					INTEGER (0..maxNrofSymbols-1)															OPTIONAL	-- Need R
+}
+
+TDD-UL-DL-ConfigDedicated ::=		SEQUENCE {
+	-- The slotSpecificConfiguration allows overriding UL/DL allocations provided in tdd-UL-DL-configurationCommon. 
+	-- FFS_ASN1: Consider making this an AddMod/Release list
+	-- FFS_ASN1: Replace absolute numbers by variables... once RAN1 confirms. 
+	-- FFS_CHECK: This list will grow very large if used for many slots.
+	slotSpecificConfigurationsToAddModList		SEQUENCE (SIZE (1..maxNrofSlots)) OF TDD-UL-DL-SlotConfig							OPTIONAL, -- Need N
+	slotSpecificConfigurationsToreleaseList		SEQUENCE (SIZE (1..maxNrofSlots)) OF TDD-UL-DL-SlotIndex						OPTIONAL -- Need N
+}
+
+TDD-UL-DL-SlotConfig ::=			SEQUENCE {
+	-- Identifies a slot within a dl-UL-TransmissionPeriodicity (given in tdd-UL-DL-configurationCommon)
+	slotIndex							TDD-UL-DL-SlotIndex,
+		
+	-- The direction (downlink or uplink) for the symbols in this slot. "allDownlink" indicates that all symbols in this slot are used
+	-- for downlink; "allUplink" indicates that all symbols in this slot are used for uplink; "explicit" indicates explicitly how many symbols 
+	-- in the beginning and end of this slot are allocated to downlink and uplink, respectively.
+	symbols								CHOICE {
+		allDownlink							NULL,
+		allUplink							NULL,
+		explicit							SEQUENCE {
+			-- Number of consecutive DL symbols in the beginning of the slot identified by slotIndex.
+			-- If the field is absent the UE assumes that there are no leading DL symbols.
+			-- Corresponds to L1 parameter 'number-of-DL-symbols-dedicated' (see 38.211, section FFS_Section)
+			nrofDownlinkSymbols					INTEGER (1..maxNrofSymbols-1)												OPTIONAL,	-- Need S
+			
+			-- Number of consecutive UL symbols in the end of the slot identified by slotIndex.
+			-- If the field is absent the UE assumes that there are no trailing UL symbols.
+			-- Corresponds to L1 parameter 'number-of-UL-symbols-dedicated' (see 38.211, section FFS_Section)
+			nrofUplinkSymbols					INTEGER (1..maxNrofSymbols-1)												OPTIONAL	-- Need S
+		}
+	}
+}
+
+TDD-UL-DL-SlotIndex ::=				INTEGER (0..maxNrofSlots-1)
+
+-- TAG-TDD-UL-DL-CONFIG-STOP
+
+TimeToTrigger ::=					ENUMERATED {
+										ms0, ms40, ms64, ms80, ms100, ms128, ms160, ms256,
+										ms320, ms480, ms512, ms640, ms1024, ms1280, ms2560,
+										ms5120}
+
+-- TAG-ZP-CSI-RS-RESOURCE-START
+
+ZP-CSI-RS-Resource ::=						SEQUENCE {
+	-- ZP CSI-RS resource configuration ID
+	-- Corresponds to L1 parameter 'ZP-CSI-RS-ResourceConfigId' (see 38.214, section 5.1.4.2)
+	zp-CSI-RS-ResourceId						ZP-CSI-RS-ResourceId,
+	-- OFDM symbol and subcarrier occupancy of the ZP-CSI-RS resource within a slot
+	resourceMapping								CSI-RS-ResourceMapping,
+	-- Periodicity and slot offset for periodic/semi-persistent ZP-CSI-RS
+	-- Corresponds to L1 parameter 'ZP-CSI-RS-timeConfig' (see 38.214, section 5.1.4.2)
+	periodicityAndOffset						CSI-ResourcePeriodicityAndOffset							OPTIONAL, --Cond PeriodicOrSemiPersistent
+
+	...
+}
+
+ZP-CSI-RS-ResourceId ::=							INTEGER (0..maxNrofZP-CSI-RS-Resources-1)
+
+-- TAG-ZP-CSI-RS-RESOURCE-STOP
+-- TAG-ZP-CSI-RS-RESOURCESET-START
+
+ZP-CSI-RS-ResourceSet ::= 						SEQUENCE {
+	zp-CSI-RS-ResourceSetId							ZP-CSI-RS-ResourceSetId,
+	-- The list of ZP-CSI-RS-ResourceId identifying the ZP-CSI-RS-Resource elements belonging to this set. 
+	zp-CSI-RS-ResourceIdList							SEQUENCE (SIZE(1..maxNrofZP-CSI-RS-ResourcesPerSet)) OF ZP-CSI-RS-ResourceId,
+	-- Time domain behavior of ZP-CSI-RS resource configuration. 
+	-- Corresponds to L1 parameter 'ZP-CSI-RS-ResourceConfigType' (see 38.214, section 5.1.4.2)
+	resourceType									ENUMERATED {aperiodic, semiPersistent, periodic},
+	...
+}
+
+-- TAG-ZP-CSI-RS-RESOURCESET-STOP
+-- TAG-ZP-CSI-RS-RESOURCESETID-START
+
+ZP-CSI-RS-ResourceSetId ::= 					INTEGER (0..maxNrofZP-CSI-RS-ResourceSets-1)
+
+-- TAG-ZP-CSI-RS-RESOURCESETID-STOP
+-- TAG-BANDCOMBINATIONLIST-START
+
+BandCombinationList ::=	SEQUENCE (SIZE (1..maxBandComb)) OF BandCombination
+
+BandCombination ::= SEQUENCE {
+	bandAndDL-ParametersList			BandAndDL-ParametersList,
+	bandCombinationsUL					BIT STRING (SIZE (1.. maxBandComb)),
+	bandCombinationParametersList		SEQUENCE (SIZE (1..maxBandComb)) OF BandCombinationParameters 	OPTIONAL
+}
+
+BandAndDL-ParametersList ::= SEQUENCE (SIZE (1..maxSimultaneousBands)) OF BandAndDL-Parameters
+
+BandAndDL-Parameters ::= CHOICE {
+	bandAndDL-ParametersEUTRA	BandAndDL-ParametersEUTRA,
+	bandAndDL-ParametersNR		BandAndDL-ParametersNR
+}
+BandCombinationParameters ::= SEQUENCE {
+	ca-ParametersNR					CA-ParametersNR			OPTIONAL,
+	mrdc-Parameters					MRDC-Parameters			OPTIONAL
+}
+
+CA-ParametersNR ::=	SEQUENCE {
+	multipleTimingAdvances		ENUMERATED {supported}				OPTIONAL,
+-- R4 2-5: Simultaneous reception and transmission for inter band CA (TDD-TDD or TDD-FDD)
+	simultaneousRxTxInterBandCA			ENUMERATED {supported}		OPTIONAL,
+-- BCS related to R4 2-1 and Updated CA BW class in R4-1803374
+	supportedBandwidthCombinationSet	BIT STRING (SIZE (1..32))	OPTIONAL
+}
+
+MRDC-Parameters ::=	SEQUENCE {
+	singleUL-Transmission		ENUMERATED {supported}		OPTIONAL,
+-- R4 1-10: Support of EN-DC with LTE-NR coexistence in UL sharing from UE perspective
+	ul-SharingEUTRA-NR					ENUMERATED {supported}		OPTIONAL,
+-- R4 1-11: Switching time between LTE UL and NR UL for EN-DC with LTE-NR coexistence in UL sharing from UE perspective
+	ul-SwitchingTimeEUTRA-NR			ENUMERATED {type1, type2}	OPTIONAL,
+-- R4 2-4: Simultaneous reception and transmission for inter-band EN-DC (TDD-TDD or TDD-FDD)
+	simultaneousRxTxInterBandENDC		ENUMERATED {supported}		OPTIONAL,
+-- R4 2-6: Asynchronous FDD-FDD intra-band EN-DC
+	asyncIntraBandENDC					ENUMERATED {supported}		OPTIONAL,
+	basebandProcesingCombinationMRDC 	BasebandProcessingCombinationMRDC
+}
+
+BandAndDL-ParametersEUTRA ::= SEQUENCE {
+	bandEUTRA					FreqBandIndicatorEUTRA,
+	ca-BandwidthClassDL-EUTRA	CA-BandwidthClassEUTRA		OPTIONAL,
+	intraBandContiguousCC-InfoDL-EUTRA-List		SEQUENCE (SIZE (1.. maxNrofServingCellsEUTRA)) OF IntraBandContiguousCC-InfoDL-EUTRA		OPTIONAL
+}
+
+BandAndDL-ParametersNR ::= SEQUENCE {
+	bandNR						FreqBandIndicatorNR,
+	ca-BandwidthClassDL			CA-BandwidthClassNR			OPTIONAL,
+-- R4 2-3: Non-contiguous intra-band CA frequency separation class for FR2 as in the RAN4 LS R4-1803363
+	intraBandFreqSeparationDL	FreqSeparationClass					OPTIONAL,
+	intraBandContiguousCC-InfoDL-List		SEQUENCE (SIZE (1.. maxNrofServingCells)) OF IntraBandContiguousCC-InfoDL		OPTIONAL
+}
+
+IntraBandContiguousCC-InfoDL ::=	SEQUENCE {
+-- Related to RAN4 LS R2-1804078
+	maxNumberMIMO-LayersPDSCH			MIMO-LayersDL					OPTIONAL
+}
+
+IntraBandContiguousCC-InfoDL-EUTRA ::=	SEQUENCE {
+-- Related to RAN4 LS R2-1804078
+	mimo-CapabilityDL					ENUMERATED {twoLayers, fourLayers, eightLayers}					OPTIONAL
+}
+
+-- TAG-BANDCOMBINATIONLIST-STOP
+-- TAG-BANDCOMBINATIONPARAMETERSULLIST-START
+
+BandCombinationParametersUL-List ::= SEQUENCE (SIZE (1..maxBandComb)) OF BandCombinationParametersUL
+
+BandCombinationParametersUL ::= SEQUENCE (SIZE (1.. maxSimultaneousBands)) OF BandParametersUL
+
+BandParametersUL ::= CHOICE {
+	bandParametersUL-EUTRA		BandParametersUL-EUTRA,
+	bandParametersUL-NR			BandParametersUL-NR
+}
+
+BandParametersUL-EUTRA ::= SEQUENCE {
+	ca-BandwidthClassUL-EUTRA	CA-BandwidthClassEUTRA		OPTIONAL,
+	intraBandContiguousCC-InfoUL-EUTRA-List		SEQUENCE (SIZE (1.. maxNrofServingCellsEUTRA)) OF IntraBandContiguousCC-InfoUL-EUTRA		OPTIONAL
+}
+
+BandParametersUL-NR ::= SEQUENCE {
+	ca-BandwidthClassUL			CA-BandwidthClassNR 				OPTIONAL,
+-- R4 2-3: Non-contiguous intra-band CA frequency separation class for FR2 as in the RAN4 LS R4-1803363
+	intraBandFreqSeparationUL	FreqSeparationClass					OPTIONAL,
+	intraBandContiguousCC-InfoUL-List		SEQUENCE (SIZE (1.. maxNrofServingCells)) OF IntraBandContiguousCC-InfoUL			OPTIONAL
+}
+
+IntraBandContiguousCC-InfoUL ::=	SEQUENCE {
+-- Related to RAN4 LS R2-1804078
+	maxNumberMIMO-LayersCB-PUSCH		MIMO-LayersUL					OPTIONAL,
+	maxNumberMIMO-LayersNonCB-PUSCH		MIMO-LayersUL					OPTIONAL
+}
+
+IntraBandContiguousCC-InfoUL-EUTRA ::=	SEQUENCE {
+-- Related to RAN4 LS R2-1804078
+	mimo-CapabilityUL						ENUMERATED {twoLayers, fourLayers}					OPTIONAL
+}
+
+-- TAG-BANDCOMBINATIONPARAMETERSULLIST-STOP
+-- TAG-BASEBANDCOMBINATIONPARAMETERSULLIST-START
+
+BasebandCombinationParametersUL-List ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandCombinationParametersUL
+
+BasebandCombinationParametersUL ::= SEQUENCE (SIZE (1..maxSimultaneousBands)) OF BasebandParametersPerBandUL
+
+BasebandParametersPerBandUL ::= SEQUENCE {
+	ca-BandwidthClassUL				CA-BandwidthClassNR,
+	freqRange						ENUMERATED {fr1, fr2},
+	basebandParametersPerCC-UL		SEQUENCE (SIZE (1.. maxNrofServingCells)) OF BasebandParametersPerCC-UL
+}
+
+BasebandParametersPerCC-UL ::= SEQUENCE {
+-- R4 2-2: Simultaneous reception or transmission with same or  different numerologies in CA
+-- It is expressed by the combination of SCS whether simultaneous RxTx is supported or not.
+	supportedSubcarrierSpacingUL				SubcarrierSpacing,
+-- Accoding to the RAN4 LS R4-1803563, maximum Bandwidth supported per CC is added in BPC
+-- FFS how to work together with BCS and max BW for each CC to be defined for each CA band combination in the RAN4 spec.
+	supportedBandwidthUL		CHOICE {
+		fr1							ENUMERATED {mhz5, mhz10, mhz15, mhz20, mhz25, mhz30, mhz40, mhz50, mhz60, mhz80, mhz100},
+		fr2							ENUMERATED {mhz50, mhz100, mhz200, mhz400}
+	},
+	-- R2-1800012. To be confirmed by RAN1
+	scalingFactor0dot75				ENUMERATED {supported}		OPTIONAL,
+-- R1 2-14: Codebook based PUSCH MIMO transmission. Absence of this field implies that CB-based PUSCH is not supported.
+	maxNumberMIMO-LayersCB-PUSCH		MIMO-LayersUL					OPTIONAL,
+-- R1 2-15: Non-codebook based PUSCH MIMO transmission. Absence of this field implies that Non-CB-based PUSCH is not supported.
+	maxNumberMIMO-LayersNonCB-PUSCH		MIMO-LayersUL					OPTIONAL,
+-- Accoding to the RAN4 LS R4-1803563, modulation order is added per CC granularity in BPC
+-- FFS whether all of modulation order specified in the spec need to be signalled.
+-- FFS how to address the requirements agreed by RAN4, e.g. mandaotry w/o capabiltiy for 64QAM. mandaotry with capabiltiy for DL 256QAM in FR1.
+	supportedModulationOrderUL					ModulationOrder					OPTIONAL,
+-- R1 2-53: SRS resources
+	supportedSRS-Resources			SRS-Resources								OPTIONAL,
+-- R1 2-55: SRS Tx switch
+	srs-TxSwitch					SRS-TxSwitch								OPTIONAL,
+-- R1 2-57: Support low latency CSI feedback
+	lowLatencyCSI-Feedback				ENUMERATED {supported}					OPTIONAL,
+-- R1 5-12 & 5-12a: Up to 2/7 PUSCHs per slot for different TBs
+	pusch-DifferentTB-PerSlot		SEQUENCE {
+		scs-15kHz						ENUMERATED {upto2, upto7}					OPTIONAL,
+		scs-30kHz						ENUMERATED {upto2, upto7}					OPTIONAL,
+		scs-60kHz						ENUMERATED {upto2, upto7}					OPTIONAL,
+		scs-120kHz						ENUMERATED {upto2, upto7}					OPTIONAL
+	}																			OPTIONAL,
+-- R1 6-7: Two PUCCH group
+	twoPUCCH-Group					ENUMERATED {supported}						OPTIONAL,
+-- R1 6-8: Different numerology across PUCCH groups
+	diffNumerologyAcrossPUCCH-Group	ENUMERATED {supported}						OPTIONAL,
+-- R1 6-9: Different numerologies across carriers within the same PUCCH group
+	diffNumerologyWithinPUCCH-Group	ENUMERATED {supported}						OPTIONAL,
+-- R1 6-10: Cross carrier scheduling
+	crossCarrierScheduling			ENUMERATED {supported}						OPTIONAL,
+-- R1 6-11: Number of supported TAGs
+	supportedNumberTAG				ENUMERATED {n2, n3, n4}						OPTIONAL,
+-- R1 6-18: Supplemental uplink with dynamic switch
+	dynamicSwitchSUL				ENUMERATED {supported}						OPTIONAL,
+-- R1 6-19: Simultaneous transmission of SRS on an SUL/non-SUL carrier and PUSCH/PUCCH/SRS/PRACH on the other UL carrier in the same cell
+-- Details on the channel/signal combination are to be described in TS 38.306
+	simultaneousTxSUL-NonSUL		ENUMERATED {supported}						OPTIONAL,
+-- R1 6-22: UL search space sharing for CA
+	searchSpaceSharingCA-UL			ENUMERATED {supported}						OPTIONAL
+}
+
+-- TAG-BASEBANDCOMBINATIONPARAMETERSULLIST-STOP
+-- TAG-BASEBANDPROCESSINGCOMBINATIONMRDC-START
+
+BasebandProcessingCombinationMRDC ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandProcessingCombinationLink
+
+BasebandProcessingCombinationLink ::= SEQUENCE {
+	basebandProcessingCombinationIndexMN		BasebandProcessingCombinationIndex, 
+	basebandProcessingCombinationLinkedIndexSN	SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandProcessingCombinationIndex
+}
+
+BasebandProcessingCombinationIndex ::= INTEGER (1..maxBasebandProcComb)
+
+-- TAG-BASEBANDPROCESSINGCOMBINATIONMRDC-STOP
+-- TAG-CA-BANDWIDTHCLASSNR-START
+
+-- Updated based on R4-1803374
+CA-BandwidthClassNR ::= ENUMERATED {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, ...}
+
+-- TAG-CA-BANDWIDTHCLASSNR-STOP
+-- TAG-CA-BANDWIDTHCLASSEUTRA-START
+
+CA-BandwidthClassEUTRA ::=	ENUMERATED {a, b, c, d, e, f, ...}
+
+-- TAG-CA-BANDWIDTHCLASSEUTRA-STOP
+-- TAG-FREQ-BAND-INDICATOR-EUTRA-START
+
+FreqBandIndicatorEUTRA ::=	INTEGER (1..maxBandsEUTRA)
+
+-- TAG-FREQ-BAND-INDICATOR-EUTRA-STOP
+-- TAG-FREQBANDLIST-START
+
+FreqBandList ::=	SEQUENCE (SIZE (1..maxBandsMRDC)) OF FreqBandInformation
+
+FreqBandInformation ::= CHOICE {
+	bandEUTRA				FreqBandIndicatorEUTRA,
+	bandNR					FreqBandIndicatorNR
+}
+
+-- TAG-FREQBANDLIST-STOP
+-- TAG-FREQSEPARATIONCLASS-START
+
+FreqSeparationClass ::=	ENUMERATED {c1, c2, c3, ...}
+
+-- TAG-FREQSEPARATIONCLASS-STOP
+-- TAG-MIMO-LAYERS-START
+
+MIMO-LayersDL ::=	ENUMERATED {twoLayers, fourLayers, eightLayers}
+
+MIMO-LayersUL ::=	ENUMERATED {oneLayer, twoLayers, fourLayers}
+
+-- TAG-MIMO-LAYERS-STOP
+-- TAG-MODULATION-ORDER-START
+
+ModulationOrder ::=	ENUMERATED {bpsk-halfpi, bpsk, qpsk, qam16, qam64, qam256}
+
+-- TAG-MODULATION-ORDER-STOP
+-- TAG-RAT-TYPE-START
+
+RAT-Type ::= ENUMERATED {nr, eutra-nr, spare2, spare1, ...}
+
+-- TAG-RAT-TYPE-STOP
+-- TAG-SUPPORTEDBASEBANDPROCESSINGCOMBINATION-START
+
+SupportedBasebandProcessingCombination ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandProcessingCombination
+
+BasebandProcessingCombination ::= SEQUENCE {
+	basebandParametersDL			SEQUENCE (SIZE (1..maxSimultaneousBands)) OF BasebandParametersPerBandDL,
+	basebandParametersUL				BIT STRING (SIZE (1..maxBasebandProcComb))}
+
+BasebandParametersPerBandDL ::= SEQUENCE {
+	ca-BandwidthClassDL			CA-BandwidthClassNR,
+	freqRange					ENUMERATED {fr1, fr2},
+	basebandParametersPerCC-DL		SEQUENCE (SIZE (1.. maxNrofServingCells)) OF BasebandParametersPerCC-DL
+}
+
+BasebandParametersPerCC-DL ::= SEQUENCE {
+-- R4 2-2: Simultaneous reception or transmission with same or  different numerologies in CA
+-- It is expressed by the combination of SCS whether simultaneous RxTx is supported or not.
+	supportedSubcarrierSpacingDL				SubcarrierSpacing,
+-- Accoding to the RAN4 LS R4-1803563, maximum Bandwidth supported per CC is added in BPC
+-- FFS how to work together with BCS and max BW for each CC to be defined for each CA band combination in the RAN4 spec.
+	supportedBandwidthDL		CHOICE {
+		fr1							ENUMERATED {mhz5, mhz10, mhz15, mhz20, mhz25, mhz30, mhz40, mhz50, mhz60, mhz80, mhz100},
+		fr2							ENUMERATED {mhz50, mhz100, mhz200, mhz400}
+	},
+-- R2-1800012. To be confirmed by RAN1
+	scalingFactor0dot75			ENUMERATED {supported}		OPTIONAL,
+-- R1 2-2: PDSCH beam switching
+	timeDurationForQCL					SEQUENCE {
+		scs-60kHz							ENUMERATED {s7, s14, s28}				OPTIONAL,
+		sch-120kHz							ENUMERATED {s14, s28}					OPTIONAL
+	}																			OPTIONAL,
+-- R1 1-10: Support of SCell without SS/PBCH block
+	scellWithoutSSB					ENUMERATED {supported}						OPTIONAL,
+-- R1 1-11: Support of CSI-RS RRM measurement for SCell without SS/PBCH block
+	csi-RS-MeasSCellWithoutSSB		ENUMERATED {supported}						OPTIONAL,
+-- R1 2-3: PDSCH MIMO layers. Absence of this field implies support of one layer.
+	maxNumberMIMO-LayersPDSCH			MIMO-LayersDL							OPTIONAL,
+-- Accoding to the RAN4 LS R4-1803563, modulation order is added per CC granularity in BPC
+-- FFS whether all of modulation order specified in the spec need to be signalled.
+-- FFS how to address the requirements agreed by RAN4, e.g. mandaotry w/o capabiltiy for 64QAM. mandaotry with capabiltiy for DL 256QAM in FR1.
+	supportedModulationOrderDL					ModulationOrder					OPTIONAL,
+-- R1 2-15a: Association between CSI-RS and SRS
+	srs-AssocCSI-RS					ENUMERATED {supported}						OPTIONAL,
+-- R1 3-1a: For type 1 CSS with dedicated RRC configuration and for type 3 CSS, UE specific SS, CORESET resource allocation of 6RB bit-map and duration 3 OFDM symbols for FR2
+	type1-3-CSS						ENUMERATED {supported}						OPTIONAL,
+-- R1 3-5 & 3-5a: For type 1 with dedicated RRC configuration, type 3, and UE-SS,, monitoring occasion can be any OFDM symbol(s) of a slot for Case 2 (with a DCI gap)
+	pdcchMonitoringAnyOccasions		ENUMERATED {withoutDCI-gap, withDCI-gap}	OPTIONAL,
+-- R1 5-1a: UE specific RRC configure UL/DL assignment
+	ue-SpecificUL-DL-Assignment		ENUMERATED {supported}						OPTIONAL,
+-- R1 5-11 & 5-11a: Up to 2/7 unicast PDSCHs per slot for different TBs
+	pdsch-DifferentTB-PerSlot		SEQUENCE {
+		scs-15kHz						ENUMERATED {upto2, upto7}					OPTIONAL,
+		scs-30kHz						ENUMERATED {upto2, upto7}					OPTIONAL,
+		scs-60kHz						ENUMERATED {upto2, upto7}					OPTIONAL,
+		scs-120kHz						ENUMERATED {upto2, upto7}					OPTIONAL
+	}																			OPTIONAL,
+-- R1 6-10: Cross carrier scheduling
+	crossCarrierScheduling			ENUMERATED {supported}						OPTIONAL,
+-- R1 6-21: DL search space sharing for CA
+	searchSpaceSharingCA-DL			ENUMERATED {supported}						OPTIONAL
+}
+
+-- TAG-SUPPORTEDBASEBANDPROCESSINGCOMBINATION-STOP
+-- TAG-UE-CAPABILITY-RAT-CONTAINER-LIST-START
+
+UE-CapabilityRAT-ContainerList ::=SEQUENCE (SIZE (0.. maxRAT-CapabilityContainers)) OF UE-CapabilityRAT-Container
+
+UE-CapabilityRAT-Container ::= SEQUENCE {
+	rat-Type							RAT-Type,
+	ue-CapabilityRAT-Container			OCTET STRING
+}
+
+-- TAG-UE-CAPABILITY-RAT-CONTAINER-LIST-STOP
+-- TAG-UE-MRDC-CAPABILITY-START
+
+UE-MRDC-Capability ::=	SEQUENCE {
+	measParametersMRDC					MeasParametersMRDC					OPTIONAL,
+	rf-ParametersMRDC					RF-ParametersMRDC,
+	phy-ParametersMRDC					Phy-ParametersMRDC					OPTIONAL,
+	generalParametersMRDC				GeneralParametersMRDC-XDD-Diff		OPTIONAL,
+	fdd-Add-UE-MRDC-Capabilities		UE-MRDC-CapabilityAddXDD-Mode		OPTIONAL,
+	tdd-Add-UE-MRDC-Capabilities		UE-MRDC-CapabilityAddXDD-Mode		OPTIONAL,
+	fr1-Add-UE-MRDC-Capabilities		UE-MRDC-CapabilityAddFRX-Mode		OPTIONAL,
+	fr2-Add-UE-MRDC-Capabilities		UE-MRDC-CapabilityAddFRX-Mode		OPTIONAL,
+	lateNonCriticalExtension			OCTET STRING						OPTIONAL,
+	nonCriticalExtension				SEQUENCE {}							OPTIONAL
+}
+
+UE-MRDC-CapabilityAddXDD-Mode ::=	SEQUENCE {
+	phy-ParametersMRDC-XDD-Diff		Phy-ParametersMRDC-XDD-Diff		OPTIONAL,
+	measParametersMRDC-XDD-Diff		MeasParametersMRDC-XDD-Diff		OPTIONAL,
+	generalParametersMRDC-XDD-Diff		GeneralParametersMRDC-XDD-Diff		OPTIONAL
+}
+
+UE-MRDC-CapabilityAddFRX-Mode ::=	SEQUENCE {
+	phy-ParametersMRDC-FRX-Diff		Phy-ParametersMRDC-FRX-Diff		OPTIONAL,
+	measParametersMRDC-FRX-Diff		MeasParametersMRDC-FRX-Diff
+}
+
+RF-ParametersMRDC ::= SEQUENCE {
+	supportedBandCombination	BandCombinationList,
+	bandCombinationParametersUL-List	BandCombinationParametersUL-List
+}
+
+Phy-ParametersMRDC ::= SEQUENCE {
+	phy-ParametersMRDC-XDD-Diff		Phy-ParametersMRDC-XDD-Diff		OPTIONAL,
+	phy-ParametersMRDC-FRX-Diff		Phy-ParametersMRDC-FRX-Diff		OPTIONAL
+}
+
+Phy-ParametersMRDC-XDD-Diff ::=	SEQUENCE {
+-- R1 8-1: Dynamic power sharing for LTE-NR DC
+	dynamicPowerSharing					ENUMERATED {supported}				OPTIONAL,
+-- R1 6-13 & 8-2: Case 1 Single Tx UL LTE-NR DC
+	tdm-Pattern							ENUMERATED {supported}				OPTIONAL
+}
+Phy-ParametersMRDC-FRX-Diff ::=	SEQUENCE {
+-- R1 8-1: Dynamic power sharing for LTE-NR DC
+	dynamicPowerSharing					ENUMERATED {supported}				OPTIONAL,
+-- R1 6-13 & 8-2: Case 1 Single Tx UL LTE-NR DC
+	tdm-Pattern							ENUMERATED {supported}				OPTIONAL
+}
+
+MeasParametersMRDC ::= SEQUENCE {
+	measParametersMRDC-Common		MeasParametersMRDC-Common,
+	measParametersMRDC-XDD-Diff		MeasParametersMRDC-XDD-Diff				OPTIONAL,
+	measParametersMRDC-FRX-Diff		MeasParametersMRDC-FRX-Diff
+}
+
+MeasParametersMRDC-Common ::=	SEQUENCE {
+-- R4 3-1: Independent measurement gap configurations for FR1 and FR2
+	independentGapConfig			ENUMERATED {supported}	OPTIONAL 
+}
+
+MeasParametersMRDC-XDD-Diff ::=	SEQUENCE {
+	sftd-MeasPSCell							ENUMERATED {supported}		OPTIONAL,
+	sftd-MeasNR-Cell						ENUMERATED {supported}		OPTIONAL
+}
+
+MeasParametersMRDC-FRX-Diff ::=	SEQUENCE {
+-- R4 3-2: Simultaneous reception of data and SS block with different numerologies when UE conducts the serving cell measurement or intra-frequency measurement
+	simultaneousRxDataSSB-DiffNumerology	ENUMERATED {supported}		OPTIONAL
+}
+
+GeneralParametersMRDC-XDD-Diff ::= SEQUENCE {
+	splitSRB-WithOneUL-Path				ENUMERATED {supported}		OPTIONAL,
+	splitDRB-withUL-Both-MCG-SCG		ENUMERATED {supported}		OPTIONAL,
+	srb3									ENUMERATED {supported}		OPTIONAL
+}
+
+-- TAG-UE-MRDC-CAPABILITY-STOP
+-- TAG-UE-NR-CAPABILITY-START
+
+UE-NR-Capability ::= SEQUENCE {
+	pdcp-Parameters					PDCP-Parameters, 
+	rlc-Parameters					RLC-Parameters						OPTIONAL,						
+	mac-Parameters					MAC-Parameters						OPTIONAL,						 
+	phy-Parameters					Phy-Parameters,
+	rf-Parameters					RF-Parameters,
+	measParameters					MeasParameters						OPTIONAL,
+	fdd-Add-UE-NR-Capabilities		UE-NR-CapabilityAddXDD-Mode			OPTIONAL,
+	tdd-Add-UE-NR-Capabilities		UE-NR-CapabilityAddXDD-Mode			OPTIONAL,
+	fr1-Add-UE-NR-Capabilities		UE-NR-CapabilityAddFRX-Mode			OPTIONAL,
+	fr2-Add-UE-NR-Capabilities		UE-NR-CapabilityAddFRX-Mode			OPTIONAL,
+	lateNonCriticalExtension		OCTET STRING						OPTIONAL,
+	nonCriticalExtension			SEQUENCE {}							OPTIONAL
+}
+
+UE-NR-CapabilityAddXDD-Mode ::=	SEQUENCE {
+	phy-ParametersXDD-Diff			Phy-ParametersXDD-Diff			OPTIONAL,
+	mac-ParametersXDD-Diff			MAC-ParametersXDD-Diff			OPTIONAL,
+	measParametersXDD-Diff			MeasParametersXDD-Diff			OPTIONAL
+}
+
+UE-NR-CapabilityAddFRX-Mode ::=	SEQUENCE {
+	phy-ParametersFRX-Diff			Phy-ParametersFRX-Diff			OPTIONAL,
+	measParametersFRX-Diff			MeasParametersFRX-Diff			OPTIONAL
+}
+
+Phy-Parameters ::=	SEQUENCE {
+	phy-ParametersCommon			Phy-ParametersCommon				OPTIONAL,
+	phy-ParametersXDD-Diff			Phy-ParametersXDD-Diff				OPTIONAL,
+	phy-ParametersFRX-Diff			Phy-ParametersFRX-Diff				OPTIONAL,
+	phy-ParametersFR1				Phy-ParametersFR1					OPTIONAL,
+	phy-ParametersFR2				Phy-ParametersFR2					OPTIONAL,
+	supportedBasebandProcessingCombination		SupportedBasebandProcessingCombination,
+	basebandCombinationParametersUL-List		BasebandCombinationParametersUL-List
+}
+
+Phy-ParametersCommon ::=	SEQUENCE {
+-- R1 1-9: CSI-RS based CFRA for HO
+	csi-RS-CFRA-ForHO					ENUMERATED {supported}						OPTIONAL,
+-- R1 2-11: Downlink dynamic PRB bundling (DL)
+	dynamicPRB-BundlingDL				ENUMERATED {supported}						OPTIONAL,
+-- R1 2-32a: Semi-persistent CSI report on PUCCH
+	sp-CSI-ReportPUCCH					ENUMERATED {supported}						OPTIONAL,
+-- R1 2-32b: Semi-persistent CSI report on PUSCH
+	sp-CSI-ReportPUSCH					ENUMERATED {supported}						OPTIONAL,
+-- R1 2-34: NZP-CSI-RS  based interference measurement
+	nzp-CSI-RS-IntefMgmt				ENUMERATED {supported}						OPTIONAL,
+-- R1 2-42: Support Type II SP-CSI feedback on long PUCCH
+	type2-SP-CSI-Feedback-LongPUCCH		ENUMERATED {supported}						OPTIONAL,
+-- R1 3-3: More than one CORESET per BWP (in addition to CORESET #0)
+	multipleCORESET						ENUMERATED {supported}						OPTIONAL,
+-- R1 3-6: Dynamic SFI monitoring and dynamic UL/DL determination
+	dynamicSFI							ENUMERATED {supported}						OPTIONAL,
+-- R1 3-7: Precoder-granularity of CORESET size
+	precoderGranularityCORESET			ENUMERATED {supported}						OPTIONAL,
+-- R1 4-10: Dynamic HARQ-ACK codebook
+	dynamicHARQ-ACK-Codebook			ENUMERATED {supported}						OPTIONAL,
+-- R1 4-11: Semi-static HARQ-ACK codebook
+	semiStaticHARQ-ACK-Codebook			ENUMERATED {supported}						OPTIONAL,
+-- R1 4-12: HARQ-ACK spatial bundling for PUCCH or PUSCH per PUCCH group
+	spatialBundlingHARQ-ACK				ENUMERATED {supported}						OPTIONAL,
+-- R1 4-21: Dynamic beta-offset configuration and indication for HARQ-ACK and/or CSI
+	dynamicBetaOffsetInd-HARQ-ACK-CSI	ENUMERATED {supported}						OPTIONAL,
+-- R1 4-23: Repetitions for PUCCH format 1, 3,and 4 over multiple slots with K = 1, 2, 4, 8
+	pucch-Repetition-F1-3-4				ENUMERATED {supported}						OPTIONAL,
+-- R1 5-2: RA type 0 for PUSCH
+	ra-Type0-PUSCH						ENUMERATED {supported}						OPTIONAL,
+-- R1 5-3: Dynamic switching between RA type 0 and RA type 1 for PDSCH
+	dynamicSwitchRA-Type0-1-PDSCH		ENUMERATED {supported}						OPTIONAL,
+-- R1 5-4: Dynamic switching between RA type 0 andRA type 1 for PUSCH
+	dynamicSwitchRA-Type0-1-PUSCH		ENUMERATED {supported}						OPTIONAL,
+-- R1 5-6: PDSCH mapping type A with less than 7 OFDM symbols
+	pdsch-MappingTypeA					ENUMERATED {supported}						OPTIONAL,
+-- R1 5-6a: PDSCH mapping type B
+	pdsch-MappingTypeB					ENUMERATED {supported}						OPTIONAL,
+-- R1 5-7: Interleaving for VRB-to-PRB mapping for PDSCH
+	interleavingVRB-ToPRB-PDSCH			ENUMERATED {supported}						OPTIONAL,
+-- R1 5-8: Interleaving for VRB-to-PRB mapping for PUSCH
+	interleavingVRB-ToPRB-PUSCH			ENUMERATED {supported}						OPTIONAL,
+-- R1 5-10: Inter-slot frequency hopping for PUSCH
+	interSlotFreqHopping-PUSCH			ENUMERATED {supported}						OPTIONAL,
+-- R1 5-13: Type 1 configured PUSCH repetitions within a slot
+	type1-PUSCH-RepetitionOneSlot		ENUMERATED {supported}						OPTIONAL,
+-- R1 5-14: Type 1 configured PUSCH repetitions over multiple slots
+	type1-PUSCH-RepetitionMultiSlots	ENUMERATED {supported}						OPTIONAL,
+-- R1 5-15: Type 2 configured PUSCH repetitions within a slot
+	type2-PUSCH-RepetitionOneSlot		ENUMERATED {supported}						OPTIONAL,
+-- R1 5-16: Type 2 configured PUSCH repetitions over multiple slots
+	type2-PUSCH-RepetitionMultiSlots	ENUMERATED {supported}						OPTIONAL,
+-- R1 5-17: PUSCH repetitions over multiple slots
+	pusch-RepetitionMultiSlots			ENUMERATED {supported}						OPTIONAL,
+-- R1 5-17a: PDSCH repetitions over multiple slots
+	pdsch-RepetitionMultiSlots			ENUMERATED {supported}						OPTIONAL,
+-- R1 5-18: DL SPS
+	downlinkSPS							ENUMERATED {supported}						OPTIONAL,
+-- R1 5-19: Type 1 Configured UL grant
+	configuredUL-GrantType1				ENUMERATED {supported}						OPTIONAL,
+-- R1 5-20: Type 2 Configured UL grant
+	configuredUL-GrantType2				ENUMERATED {supported}						OPTIONAL,
+-- R1 5-21: Pre-emption indication for DL
+	pre-EmptIndication-DL				ENUMERATED {supported}						OPTIONAL,
+-- R1 5-22 & 5-25: CBG-based re-transmission for DL/UL using CBGTI
+	cbg-TransIndication					BIT STRING (SIZE (2))						OPTIONAL,
+-- R1 5-23: CBGFI for CBG-based re-transmission for DL
+	cbg-FlushIndication-DL				ENUMERATED {supported}						OPTIONAL,
+-- R1 5-24: Dynamic HARQ-ACK codebook using sub-codebooks for CBG-based re-transmission for DL
+	dynamicHARQ-ACK-CodeB-CBG-Retx-DL	ENUMERATED {supported}						OPTIONAL,
+-- R1 5-26: Semi-static rate-matching resource set configuration for DL
+	rateMatchingResrcSetSemi-Static		ENUMERATED {supported}						OPTIONAL,
+-- R1 5-27: Dynamic rate-matching resource set configuration for DL
+	rateMatchingResrcSetDynamic			ENUMERATED {supported}						OPTIONAL,
+-- R1 5-28: Rate-matching around LTE CRS
+	rateMatchingLTE-CRS					ENUMERATED {supported}						OPTIONAL,
+-- R4 1-8: BWP switching delay
+	bwp-SwitchingDelay					ENUMERATED {type1, type2}					OPTIONAL
+}
+
+Phy-ParametersXDD-Diff ::=	SEQUENCE {
+-- R1 4-2: 2 PUCCH of format 0 or 2 in consecutive symbols
+	twoPUCCH-F0-2-ConsecSymbols			ENUMERATED {supported}						OPTIONAL,
+-- R1 8-7: UL power control with 2 PUSCH closed loops
+	twoDifferentTPC-Loop-PUSCH			ENUMERATED {supported}						OPTIONAL,
+-- R1 8-8: UL power control with 2 PUCCH closed loops
+	twoDifferentTPC-Loop-PUCCH			ENUMERATED {supported}						OPTIONAL
+}
+
+Phy-ParametersFRX-Diff ::=	SEQUENCE {
+-- R1 2-6 & 2-16b: Support 1+2 DMRS (DL/UL)
+	oneFL-DMRS-TwoAdditionalDMRS		BIT STRING (SIZE (2))						OPTIONAL,
+-- R1 2-7 & 2-18: Supported 2 symbols front-loaded DMRS(DL/UL)
+	twoFL-DMRS							BIT STRING (SIZE (2))						OPTIONAL,
+-- R1 2-8 & 2-18a: Supported 2 symbols front-loaded +2 symbols additional DMRS(DL/UL)
+	twoFL-DMRS-TwoAdditionalDMRS		BIT STRING (SIZE (2))						OPTIONAL,
+-- R1 2-9 & 2-19: Support 1+3 DMRS (DL/UL)
+	oneFL-DMRS-ThreeAdditionalDMRS		BIT STRING (SIZE (2))						OPTIONAL,
+-- R1 2-10: Support DMRS type (DL)
+	supportedDMRS-TypeDL				ENUMERATED {type1, type2}					OPTIONAL,
+-- R1 2-17: Support DMRS type (UL)
+	supportedDMRS-TypeUL				ENUMERATED {type1, type2}					OPTIONAL,
+-- R1 2-37: Support Semi-open loop CSI
+	semiOpenLoopCSI						ENUMERATED {supported}						OPTIONAL,
+-- R1 2-38: CSI report without PMI
+	csi-ReportWithoutPMI				ENUMERATED {supported}						OPTIONAL,
+-- R1 2-39: CSI report with CRI
+	csi-ReportWithCRI					ENUMERATED {supported}						OPTIONAL,
+-- R1 2-39a: CSI report without CQI
+	csi-ReportWithoutCQI				ENUMERATED {supported}						OPTIONAL,
+-- R1 2-44 & 2-47: 1 port of DL/UL PTRS
+	onePortsPTRS						BIT STRING (SIZE (2))						OPTIONAL,
+-- R1 4-2: 2 PUCCH of format 0 or 2 in consecutive symbols
+	twoPUCCH-F0-2-ConsecSymbols			ENUMERATED {supported}						OPTIONAL,
+-- R1 4-3: PUCCH format 2 over 1 – 2 OFDM symbols once per slot with FH
+	pucch-F2-WithFH						ENUMERATED {supported}						OPTIONAL,
+-- R1 4-4: PUCCH format 3 over 4 – 14 OFDM symbols once per slot with FH
+	pucch-F3-WithFH						ENUMERATED {supported}						OPTIONAL,
+-- R1 4-5: PUCCH format 4 over 4 – 14 OFDM symbols once per slot with FH
+	pucch-F4-WithFH						ENUMERATED {supported}						OPTIONAL,
+-- R1 4-6: Non-frequency hopping for PUCCH formats 0 and 2
+	freqHoppingPUCCH-F0-2				ENUMERATED {notSupported}					OPTIONAL,
+-- R1 4-7: Non-frequency hopping for PUCCH format 1, 3, and 4
+	freqHoppingPUCCH-F1-3-4				ENUMERATED {notSupported}					OPTIONAL,
+-- R1 4-19: SR/HARQ-ACK/CSI multiplexing once per slot using a PUCCH (or piggybacked on a PUSCH)
+	mux-SR-HARQ-ACK-CSI-PUCCH			ENUMERATED {supported}						OPTIONAL,
+-- R1 4-20: UCI code-block segmentation 
+	uci-CodeBlockSegmentation			ENUMERATED {supported}						OPTIONAL,
+-- R1 4-22: 1 long PUCCH format and 1 short PUCCH format in the same slot
+	onePUCCH-LongAndShortFormat			ENUMERATED {supported}						OPTIONAL,
+-- R1 4-22a: 2 PUCCH transmissions in the same slot which are not covered by 4-22 and 4-2
+	twoPUCCH-AnyOthersInSlot			ENUMERATED {supported}						OPTIONAL,
+-- R1 5-9: Intra-slot frequency-hopping for PUSCH except for PUSCH scheduled by Type 1 before RRC connection
+	intraSlotFreqHopping-PUSCH			ENUMERATED {supported}						OPTIONAL,
+-- R1 5-29: LBRM for PUSCH
+	pusch-LBRM							ENUMERATED {supported}						OPTIONAL,
+-- R1 6-5a: PDCCH blind detection capability for CA
+	pdcch-BlindDetectionCA				ENUMERATED {supported}						OPTIONAL,
+-- R1 8-3: TPC-PUSCH-RNTI
+	tpc-PUSCH-RNTI						ENUMERATED {supported}						OPTIONAL,
+-- R1 8-4: TPC-PUCCH-RNTI
+	tpc-PUCCH-RNTI						ENUMERATED {supported}						OPTIONAL,
+-- R1 8-5: TPC-SRS-RNTI
+	tpc-SRS-RNTI						ENUMERATED {supported}						OPTIONAL,
+-- R1 8-6: Absolute TPC command mode
+	absoluteTPC-Command					ENUMERATED {supported}						OPTIONAL,
+-- R1 8-7: UL power control with 2 PUSCH closed loops
+	twoDifferentTPC-Loop-PUSCH			ENUMERATED {supported}						OPTIONAL,
+-- R1 8-8: UL power control with 2 PUCCH closed loops
+	twoDifferentTPC-Loop-PUCCH			ENUMERATED {supported}						OPTIONAL,
+-- R4 1-6: pi/2-BPSK for PUSCH
+	pusch-HalfPi-BPSK					ENUMERATED {supported}						OPTIONAL,
+-- R4 1-7: pi/2-BPSK for PUCCH format 3/4
+	pucch-F3-4-HalfPi-BPSK				ENUMERATED {supported}						OPTIONAL,
+-- R4 1-9: 1-symbol GP in unpaired spectrum
+	oneSymbolGP-TDD						ENUMERATED {supported}						OPTIONAL,
+-- R4 2-7: Almost contiguous UL CP-OFDM
+	almostContiguousCP-OFDM-UL			ENUMERATED {supported}						OPTIONAL
+}
+
+Phy-ParametersFR1 ::=	SEQUENCE {
+-- R1 3-2: Unicast PDCCH monitoring following Case 1-2
+	pdcchMonitoringSingleOccasion		ENUMERATED {supported}						OPTIONAL,
+-- R4 1-1: 60kHz of subcarrier spacing for FR1
+	scs-60kHz							ENUMERATED {supported}						OPTIONAL,
+-- R4 1-4: 256QAM for PDSCH in FR1
+	pdsch-256QAM-FR1					ENUMERATED {supported}						OPTIONAL
+}
+
+Phy-ParametersFR2 ::=	SEQUENCE {
+-- R4 2-8: PA calibration gap
+	calibrationGapPA					ENUMERATED {supported}						OPTIONAL
+}
+
+RF-Parameters ::= SEQUENCE {
+	supportedBandListNR					SupportedBandListNR,
+	supportedBandCombination			BandCombinationList,
+	bandCombinationParametersUL-List	BandCombinationParametersUL-List
+}
+
+SupportedBandListNR ::=	SEQUENCE (SIZE (1..maxBands)) OF BandNR
+
+BandNR ::=	SEQUENCE {
+	bandNR							FreqBandIndicatorNR,
+-- Modified MPR behaviour as in RAN4 LS R2-1804077, which is needed for NSA as well as SA
+	modifiedMPR-Behaviour			BIT STRING (SIZE (8))						OPTIONAL,
+-- R4 2-1: Maximum channel bandwidth supported in each band for DL and UL separately and for each SCS that UE supports within a single CC
+-- RAN4 agreed that 400 MHz is optional for FR2. The other values defined for FR1/fR2 in TS 38.101 are mandatory w/o capability bit.
+	maxChannelBW-PerCC				ENUMERATED {mhz400}							OPTIONAL,
+	mimo-ParametersPerBand			MIMO-ParametersPerBand						OPTIONAL,
+-- R1 0-10: Extended CP
+	extendedCP						ENUMERATED {supported}						OPTIONAL,
+-- R1 0-13: Phase coherence across non-contiguous UL symbols in slot in the transmission of one channel
+	phaseCoherenceUL				ENUMERATED {supported}						OPTIONAL,
+-- R1 1-10: Support of SCell without SS/PBCH block
+	scellWithoutSSB					ENUMERATED {supported}						OPTIONAL,
+-- R1 1-11: Support of CSI-RS RRM measurement for SCell without SS/PBCH block
+	csi-RS-MeasSCellWithoutSSB		ENUMERATED {supported}						OPTIONAL,
+-- R1 2-15a: Association between CSI-RS and SRS
+	srs-AssocCSI-RS					ENUMERATED {supported}						OPTIONAL,
+-- R1 3-1a: For type 1 CSS with dedicated RRC configuration and for type 3 CSS, UE specific SS, CORESET resource allocation of 6RB bit-map and duration 3 OFDM symbols for FR2
+	type1-3-CSS						ENUMERATED {supported}						OPTIONAL,
+-- R1 3-4: More than one TCI state configurations per CORESET
+	multipleTCI						ENUMERATED {supported}						OPTIONAL,
+-- R1 3-5 & 3-5a: For type 1 with dedicated RRC configuration, type 3, and UE-SS,, monitoring occasion can be any OFDM symbol(s) of a slot for Case 2 (with a DCI gap)
+	pdcchMonitoringAnyOccasions		ENUMERATED {withoutDCI-gap, withDCI-gap}	OPTIONAL,
+-- R1 5-1a: UE specific RRC configure UL/DL assignment
+	ue-SpecificUL-DL-Assignment		ENUMERATED {supported}						OPTIONAL,
+-- R1 5-11 & 5-11a: Up to 2/7 unicast PDSCHs per slot for different TBs
+	pdsch-DifferentTB-PerSlot		SEQUENCE {
+		scs-15kHz						ENUMERATED {upto2, upto7}				OPTIONAL,
+		scs-30kHz						ENUMERATED {upto2, upto7}				OPTIONAL,
+		scs-60kHz						ENUMERATED {upto2, upto7}				OPTIONAL,
+		scs-120kHz						ENUMERATED {upto2, upto7}				OPTIONAL
+	}																			OPTIONAL,
+-- R1 5-12 & 5-12a: Up to 2/7 PUSCHs per slot for different TBs
+	pusch-DifferentTB-PerSlot		SEQUENCE {
+		scs-15kHz						ENUMERATED {upto2, upto7}				OPTIONAL,
+		scs-30kHz						ENUMERATED {upto2, upto7}				OPTIONAL,
+		scs-60kHz						ENUMERATED {upto2, upto7}				OPTIONAL,
+		scs-120kHz						ENUMERATED {upto2, upto7}				OPTIONAL
+	}																			OPTIONAL,
+-- R1 6-2 & 6-3: Type A/B BWP adaptation (up to 2/4 BWPs) with same numerology
+	bwp-SameNumerology					ENUMERATED {upto2, upto4}				OPTIONAL,
+-- R1 6-4: BWP adaptation (up to 4 BWPs) with different numerologies
+	bwp-DiffNumerology					ENUMERATED {upto4}						OPTIONAL,
+-- R1 6-7: Two PUCCH group
+	twoPUCCH-Group					ENUMERATED {supported}						OPTIONAL,
+-- R1 6-8: Different numerology across PUCCH groups
+	diffNumerologyAcrossPUCCH-Group	ENUMERATED {supported}						OPTIONAL,
+-- R1 6-9: Different numerologies across carriers within the same PUCCH group
+	diffNumerologyWithinPUCCH-Group	ENUMERATED {supported}						OPTIONAL,
+-- R1 6-10: Cross carrier scheduling
+	crossCarrierScheduling			ENUMERATED {supported}						OPTIONAL,
+-- R1 6-11: Number of supported TAGs
+	supportedNumberTAG				ENUMERATED {n2, n3, n4}						OPTIONAL,
+-- R1 6-19: Simultaneous transmission of SRS on an SUL/non-SUL carrier and PUSCH/PUCCH/SRS/PRACH on the other UL carrier in the same cell
+-- Details on the channel/signal combination are to be described in TS 38.306
+	simultaneousTxSUL-NonSUL		ENUMERATED {supported}						OPTIONAL,
+-- R1 6-21: DL search space sharing for CA
+	searchSpaceSharingCA-DL			ENUMERATED {supported}						OPTIONAL,
+-- R1 6-22: UL search space sharing for CA
+	searchSpaceSharingCA-UL			ENUMERATED {supported}						OPTIONAL,
+-- R4 1-4: 256QAM for PDSCH in FR2
+	pdsch-256QAM-FR2				ENUMERATED {supported}						OPTIONAL,
+-- R4 1-5: 256QAM for PUSCH
+	pusch-256QAM					ENUMERATED {supported}						OPTIONAL
+}
+
+MIMO-ParametersPerBand ::= SEQUENCE {
+-- R1 2-2: PDSCH beam switching
+	timeDurationForQCL					SEQUENCE {
+		scs-60kHz							ENUMERATED {s7, s14, s28}									OPTIONAL,
+		sch-120kHz							ENUMERATED {s14, s28}										OPTIONAL
+	}																									OPTIONAL,
+-- R1 2-3: PDSCH MIMO layers. Absence of this field implies support of one layer.
+	maxNumberMIMO-LayersPDSCH			MIMO-LayersDL													OPTIONAL,
+-- R1 2-14: Codebook based PUSCH MIMO transmission. Absence of this field implies that CB-based PUSCH is not supported.
+	maxNumberMIMO-LayersCB-PUSCH		MIMO-LayersUL													OPTIONAL,
+-- R1 2-15: Non-codebook based PUSCH MIMO transmission. Absence of this field implies that Non-CB-based PUSCH is not supported.
+	maxNumberMIMO-LayersNonCB-PUSCH		MIMO-LayersUL													OPTIONAL,
+-- R1 2-4: TCI states for PDSCH
+	maxNumberConfiguredTCIstates		ENUMERATED {n4, n8, n16, n32, n64}								OPTIONAL,
+	maxNumberActiveTCI-PerCC			ENUMERATED {n1, n2, n4, n8}										OPTIONAL,
+-- R1 2-13: PUSCH transmission coherence
+	pusch-TransCoherence				ENUMERATED {nonCoherent, partialNonCoherent, fullCoherent}	OPTIONAL,
+-- R1 2-20: Beam correspondence
+	beamCorrespondence					ENUMERATED {supported}											OPTIONAL,
+-- R1 2-21: Periodic beam report on PUCCH
+	periodicBeamReport					ENUMERATED {supported}											OPTIONAL,
+-- R1 2-22: Aperiodic beam report on PUSCH
+	aperiodicBeamReport					ENUMERATED {supported}											OPTIONAL,
+-- R1 2-23: Semi-persistent beam report on PUCCH
+	sp-BeamReportPUCCH					ENUMERATED {supported}											OPTIONAL,
+-- R1 2-23a: Semi-persistent beam report on PUSCH
+	sp-BeamReportPUSCH					ENUMERATED {supported}											OPTIONAL,
+-- R1 2-24: SSB/CSI-RS for beam management
+	beamManagementSSB-CSI-RS			BeamManagementSSB-CSI-RS										OPTIONAL,
+-- R1 2-26: Receiving beam selection using CSI-RS resource repetition "ON"
+	maxNumberRxBeam						INTEGER (2..8)													OPTIONAL,
+-- R1 2-27: Beam switching (including SSB and CSI-RS)
+	maxNumberRxTxBeamSwitchDL			SEQUENCE {
+		scs-15kHz							ENUMERATED {n4, n7, n14}									OPTIONAL,
+		scs-30kHz							ENUMERATED {n4, n7, n14}									OPTIONAL,
+		scs-60kHz							ENUMERATED {n4, n7, n14}									OPTIONAL,
+		scs-120kHz							ENUMERATED {n4, n7, n14}									OPTIONAL,
+		scs-240kHz							ENUMERATED {n4, n7, n14}									OPTIONAL
+	}																									OPTIONAL,
+-- R1 2-29: Non-group based beam reporting
+	maxNumberNonGroupBeamReporting		ENUMERATED {n1, n2, n4}											OPTIONAL,
+-- R1 2-29a: Group based beam reporting
+	groupBeamReporting					ENUMERATED {supported}											OPTIONAL,
+-- R1 2-30: UL beam management
+	uplinkBeamManagement				SEQUENCE {
+		maxNumberSRS-ResourcePerSet			ENUMERATED {n8, n16, n32},
+		maxNumberSRS-ResourceSet			INTEGER (1..8)
+	}																									OPTIONAL,
+-- R1 2-31: Beam failure recovery
+	maxNumberCSI-RS-BFR					INTEGER (1..64)													OPTIONAL,
+	maxNumberSSB-BFR					INTEGER (1..64)													OPTIONAL,
+	maxNumberCSI-RS-SSB-BFR				INTEGER (1..256)												OPTIONAL,
+-- R1 2-45 & 2-48: 2 ports of DL/UL PTRS
+	twoPortsPTRS						BIT STRING (SIZE (2))											OPTIONAL,
+-- R1 2-53: SRS resources
+	supportedSRS-Resources			SRS-Resources														OPTIONAL,
+-- R1 2-55: SRS Tx switch
+	srs-TxSwitch					SRS-TxSwitch														OPTIONAL,
+-- R1 2-54a: Simultaneous SRS Tx
+	maxNumberSimultaneousSRS-PerCC		INTEGER (1..4)													OPTIONAL,
+-- R1 2-57: Support low latency CSI feedback
+	lowLatencyCSI-Feedback				ENUMERATED {supported}											OPTIONAL
+}
+
+-- R1 2-24: SSB/CSI-RS for beam management
+BeamManagementSSB-CSI-RS ::=	SEQUENCE {
+	maxNumberSSB-CSI-RS-ResourceOneTx	ENUMERATED {n8, n16, n32, n64},
+	maxNumberSSB-CSI-RS-ResourceTwoTx	ENUMERATED {n0, n4, n8, n16, n32, n64},
+	supportedCSI-RS-Density				ENUMERATED {one, three, oneAndThree}
+}
+
+-- R1 2-53: SRS resources
+SRS-Resources ::=	SEQUENCE {
+	maxNumberAperiodicSRS-PerBWP					ENUMERATED {n1, n2, n4, n8, n16},
+	maxNumberAperiodicSRS-PerBWP-PerSlot			INTEGER (1..6),
+	maxNumberPeriodicSRS-PerBWP						ENUMERATED {n1, n2, n4, n8, n16},
+	maxNumberPeriodicSRS-PerBWP-PerSlot				INTEGER (1..6),
+	maxNumberSemiPersitentSRS-PerBWP				ENUMERATED {n0, n1, n2, n4, n8, n16},
+	maxNumberSP-SRS-PerBWP-PerSlot					INTEGER (0..6),
+	maxNumberSRS-Ports-PerResource					ENUMERATED {n1, n2, n4}
+}
+-- R1 2-55: SRS Tx switch
+SRS-TxSwitch ::=	SEQUENCE {
+	supportedSRS-TxPortSwitch			ENUMERATED {t1r2, t1r4, t2r4, t1r4-t2r4},
+	txSwitchImpactToRx					ENUMERATED {true}								OPTIONAL
+}
+
+PDCP-Parameters ::= SEQUENCE {
+	supportedROHC-Profiles	SEQUENCE {
+		profile0x0000		BOOLEAN, 
+		profile0x0001		BOOLEAN, 
+		profile0x0002		BOOLEAN,
+		profile0x0003		BOOLEAN, 
+		profile0x0004		BOOLEAN, 
+		profile0x0006		BOOLEAN, 
+		profile0x0101		BOOLEAN, 
+		profile0x0102		BOOLEAN, 
+		profile0x0103		BOOLEAN, 
+		profile0x0104		BOOLEAN
+	}, 
+	maxNumberROHC-ContextSessions	ENUMERATED {cs2, cs4, cs8, cs12, cs16, cs24, cs32, cs48, cs64, cs128, cs256, cs512, cs1024, cs16384, spare2, spare1},	
+	uplinkOnlyROHC-Profiles			ENUMERATED {supported}	OPTIONAL, 
+	continueROHC-Context			ENUMERATED {supported}	OPTIONAL,
+	outOfOrderDelivery				ENUMERATED {supported}	OPTIONAL, 
+	shortSN							ENUMERATED {supported} 	OPTIONAL
+}
+
+RLC-Parameters ::= SEQUENCE {
+	am-WithShortSN					ENUMERATED {supported}	OPTIONAL,
+		um-WithShortSN					ENUMERATED {supported}	OPTIONAL, 
+		um-WIthLongSN					ENUMERATED {supported}	OPTIONAL
+}
+
+MAC-Parameters ::= SEQUENCE {
+	mac-ParametersCommon			MAC-ParametersCommon	OPTIONAL,
+	mac-ParametersXDD-Diff			MAC-ParametersXDD-Diff	OPTIONAL
+}
+
+MAC-ParametersCommon ::=	SEQUENCE {
+	lcp-Restriction					ENUMERATED {supported}	OPTIONAL,
+-- R1 4-24: PUCCH-spatialrelationinfo indication by a MAC CE per PUCCH resource
+	pucch-SpatialRelInfoMAC-CE		ENUMERATED {supported}	OPTIONAL
+}
+
+MAC-ParametersXDD-Diff ::=	SEQUENCE {
+	skipUplinkTxDynamic				ENUMERATED {supported}	OPTIONAL,
+	logicalChannelSR-DelayTimer		ENUMERATED {supported}	OPTIONAL, 
+	longDRX-Cycle					ENUMERATED {supported}	OPTIONAL, 
+	shortDRX-Cycle					ENUMERATED {supported}	OPTIONAL, 
+	multipleSR-Configurations		ENUMERATED {supported}	OPTIONAL, 
+	-- If supported UE supports 8 SR configurations, otherwise 1 SR config is supported. 
+	-- Confirmation is needed whether to align the number to what the configuration signalling can support.
+	multipleConfiguredGrantConfigurations	ENUMERATED {supported}	OPTIONAL 
+	-- If supported UE supports 16 configured grant configurations, otherwise 1 ConfiguredGrant config is supported.
+	-- Confirmation is needed whether to align the number to what the configuration signalling can support, and to consider whether the 16 refers
+	-- to the configurations or the active ones only (as they are within the BWP).
+}
+
+MeasParameters ::= SEQUENCE {
+	measParametersXDD-Diff			MeasParametersXDD-Diff		OPTIONAL,
+	measParametersFRX-Diff			MeasParametersFRX-Diff		OPTIONAL
+}
+
+MeasParametersXDD-Diff ::=	SEQUENCE {
+	intraAndInterF-MeasAndReport	ENUMERATED {supported}	OPTIONAL,
+	eventA-MeasAndReport			ENUMERATED {supported}	OPTIONAL 
+	-- Confirmation is needed on the need of capability/IOT signaling in LTE for support of the additional measurement gap configurations.
+}
+
+MeasParametersFRX-Diff ::=	SEQUENCE {
+-- R1 1-3: SSB based SINR measurement
+	ss-SINR-Meas						ENUMERATED {supported}		OPTIONAL,
+-- R1 1-5: CSI-RS based RRM measurement with associated SS-block
+	csi-RSRP-AndRSRQ-MeasWithSSB		ENUMERATED {supported}		OPTIONAL,
+-- R1 1-5a: CSI-RS based RRM measurement without associated SS-block
+	csi-RSRP-AndRSRQ-MeasWithoutSSB		ENUMERATED {supported}		OPTIONAL,
+-- R1 1-6: CSI-RS based SINR measurement
+	csi-SINR-Meas						ENUMERATED {supported}		OPTIONAL,
+-- R1 1-7: CSI-RS based RLM
+	csi-RS-RLM							ENUMERATED {supported}		OPTIONAL
+}
+
+-- TAG-UE-NR-CAPABILITY-STOP
+-- TAG-RRC-TRANSACTIONIDENTIFIER-START
+
+RRC-TransactionIdentifier ::=		INTEGER (0..3)
+
+-- TAG-RRC-TRANSACTIONIDENTIFIER-STOP
+-- TAG-MULTIPLICITY-AND-TYPE-CONSTRAINT-DEFINITIONS-START
+
+maxBandComb								INTEGER ::=	65536	-- Maximum number of DL band combinations
+maxBasebandProcComb						INTEGER ::=	65536	-- Maximum number of baseband processing combinations
+maxNrofServingCells						INTEGER ::=	32		-- Max number of serving cells (SpCell + SCells) per cell group
+maxNrofServingCells-1					INTEGER ::= 31		-- Max number of serving cells (SpCell + SCells) per cell group minus 1
+maxNrofAggregatedCellsPerCellGroup		INTEGER ::= 16
+maxNrofSCells							INTEGER ::=	31		-- Max number of secondary serving cells per cell group
+maxNrofCellMeas							INTEGER ::=	32		-- Maximum number of entries in each of the cell lists in a measurement object
+maxNrofSS-BlocksToAverage				INTEGER ::= 16		-- Max number for the (max) number of SS blocks to average to determine cell
+															-- measurement
+maxNrofCSI-RS-ResourcesToAverage			INTEGER ::= 16		-- Max number for the (max) number of CSI-RS to average to determine cell
+															-- measurement
+maxNrofDL-Allocations 					INTEGER ::= 16		-- Maximum number of PDSCH time domain resource allocations
+
+maxNrofSR-ConfigPerCellGroup				INTEGER ::= 8		-- Maximum number of SR configurations per cell group
+
+maxLCG-ID								INTEGER ::= 7		-- Maximum value of LCG ID
+maxLC-ID								INTEGER ::= 32		-- Maximum value of Logical Channel ID
+maxNrofTAGs								INTEGER ::=	4		-- Maximum number of Timing Advance Groups
+maxNrofTAGs-1							INTEGER ::=	3		-- Maximum number of Timing Advance Groups minus 1
+
+maxNrofBWPs								INTEGER ::= 4		-- Maximum number of BWPs per serving cell
+maxNrofSymbols-1						INTEGER ::= 13		-- Maximum index identifying a symbol within a slot (14 symbols, indexed from 0..13)
+maxNrofSlots							INTEGER ::= 320		-- Maximum number of slots in a 10 ms period
+maxNrofSlots-1							INTEGER ::= 319		-- Maximum number of slots in a 10 ms period minus 1
+
+maxNrofPhysicalResourceBlocks			INTEGER ::= 275		-- Maximum number of PRBs
+maxNrofPhysicalResourceBlocks-1			INTEGER ::= 274		-- Maximum number of PRBs
+maxNrofControlResourceSets 				INTEGER ::= 12 		-- Max number of CoReSets configurable on a serving cell
+maxNrofControlResourceSets-1			INTEGER ::= 11  	-- Max number of CoReSets configurable on a serving cell minus 1
+maxCoReSetDuration						INTEGER ::= 3		-- Max number of OFDM symbols in a control resource set
+maxNrofSearchSpaces						INTEGER ::= 40		-- Max number of Search Spaces
+maxNrofSearchSpaces-1					INTEGER ::= 39		-- Max number of Search Spaces minus 1
+maxSFI-DCI-PayloadSize					INTEGER ::= 128		-- Max number payload of a DCI scrambled with SFI-RNTI
+maxSFI-DCI-PayloadSize-1				INTEGER ::= 127		-- Max number payload of a DCI scrambled with SFI-RNTI minus 1
+maxINT-DCI-PayloadSize					INTEGER ::= 126		-- Max number payload of a DCI scrambled with INT-RNTI
+maxINT-DCI-PayloadSize-1				INTEGER ::= 125		-- Max number payload of a DCI scrambled with INT-RNTI minus 1
+maxNrofRateMatchPatterns				INTEGER ::= 4		-- Max number of rate matching patterns that may be configured
+maxNrofRateMatchPatterns-1				INTEGER ::= 3		-- Max number of rate matching patterns that may be configured minus 1
+
+maxNrofCSI-ReportConfigurations			INTEGER ::= 48 		-- Maximum number of report configurations
+maxNrofCSI-ReportConfigurations-1		INTEGER ::= 47		-- Maximum number of report configurations minus 1
+
+maxNrofCSI-ResourceConfigurations		INTEGER ::= 112		-- Maximum number of resource configurations
+maxNrofCSI-ResourceConfigurations-1		INTEGER ::= 111		-- Maximum number of resource configurations minus 1
+
+maxNrofAP-CSI-RS-ResourcesPerSet		INTEGER ::= 16
+maxNrOfCSI-AperiodicTriggers			INTEGER ::= 128		-- Maximum number of triggers for aperiodic CSI reporting
+maxNrofReportConfigPerAperiodicTrigger	INTEGER ::= 16		-- Maximum number of report configurations per trigger state for aperiodic reporting
+
+maxNrofNZP-CSI-RS-Resources				INTEGER ::= 192		-- Maximum number of Non-Zero-Power (NZP) CSI-RS resources
+maxNrofNZP-CSI-RS-Resources-1			INTEGER ::= 191		-- Maximum number of Non-Zero-Power (NZP) CSI-RS resources minus 1
+maxNrofNZP-CSI-RS-ResourcesPerSet		INTEGER ::= 64		-- Maximum number of NZP CSI-RS resources per resource set
+maxNrofNZP-CSI-RS-ResourceSetsPerConfig	INTEGER ::= 16		-- Maximum number of resource sets per resource configuration
+
+maxNrofZP-CSI-RS-Resources				INTEGER ::= 32		-- Maximum number of Zero-Power (NZP) CSI-RS resources
+maxNrofZP-CSI-RS-Resources-1			INTEGER ::= 31		-- Maximum number of Zero-Power (NZP) CSI-RS resources minus 1
+maxNrofZP-CSI-RS-ResourceSets-1			INTEGER ::= 16
+maxNrofZP-CSI-RS-ResourcesPerSet		INTEGER ::= 16
+maxNrofZP-CSI-RS-Sets					INTEGER ::= 16
+
+maxNrofCSI-IM-Resources					INTEGER ::= 32		-- Maximum number of CSI-IM resources. See CSI-IM-ResourceMax in 38.214.
+maxNrofCSI-IM-Resources-1				INTEGER ::= 31		-- Maximum number of CSI-IM resources minus 1. See CSI-IM-ResourceMax in 38.214.
+maxNrofCSI-IM-ResourcesPerSet			INTEGER ::= 8		-- Maximum number of CSI-IM resources per set. See CSI-IM-ResourcePerSetMax in 38.214
+maxNrofCSI-IM-ResourceSetsPerConfig 	INTEGER ::= 16		-- Maximum number of CSI IM resource sets per resource configuration
+
+maxNrofSSB-Resources-1					INTEGER ::= 63		-- Maximum number of SSB resources in a resource set minus 1
+maxNrofCSI-SSB-ResourcePerSet 			INTEGER ::= 64
+maxNrofCSI-SSB-ResourceSetsPerConfig 	INTEGER ::= 1		-- Maximum number of CSI SSB resource sets per resource configuration
+
+maxNrofFailureDetectionResources		INTEGER ::= 10		-- Maximum number of failure detection resources	
+
+maxNrofObjectId							INTEGER ::= 64		-- Maximum number of measurement objects
+maxNrofPCI-Ranges						INTEGER ::= 8		-- Maximum number of PCI ranges
+maxNrofCSI-RS-ResourcesRRM				INTEGER ::= 96		-- Maximum number of CSI-RS resources for an RRM measurement object
+maxNrofCSI-RS-ResourcesRRM-1			INTEGER ::= 95		-- Maximum number of CSI-RS resources for an RRM measurement object minus 1
+maxNrofMeasId							INTEGER ::= 64		-- Maximum number of configured measurements
+maxNrofQuantityConfig					INTEGER	::= 2		-- Maximum number of quantity configurations
+maxNrofCSI-RS-CellsRRM 					INTEGER ::= 96 		-- Maximum number of FFS
+
+maxNrofSRS-ResourceSets					INTEGER ::= 16		-- Maximum number of SRS resource sets in a BWP.
+maxNrofSRS-ResourceSets-1				INTEGER ::= 15		-- Maximum number of SRS resource sets in a BWP minus 1.
+maxNrofSRS-Resources					INTEGER ::= 64		-- Maximum number of SRS resources in an SRS resource set.
+maxNrofSRS-Resources-1					INTEGER ::= 63		-- Maximum number of SRS resources in an SRS resource set minus 1.
+maxNrofSRS-TriggerStates-1 				INTEGER ::= 3		-- Maximum number of SRS trigger states minus 1, i.e., the largest code point.
+maxRAT-CapabilityContainers				INTEGER ::= 8		-- Maximum number of interworking RAT containers (incl NR and MRDC)
+maxSimultaneousBands					INTEGER ::= 32		-- Maximum number of simultaneously aggregated bands
+
+
+maxNrofSlotFormatCombinationsPerCell	INTEGER ::= 16		-- Maximum number of
+maxNrofSlotFormatCombinationsPerSet		INTEGER ::= 4096	-- Maximum number of Slot Format Combinations in a SF-Set.
+maxNrofSlotFormatCombinationsPerSet-1	INTEGER ::= 4095	-- Maximum number of Slot Format Combinations in a SF-Set minus 1.
+maxNrofPUCCH-Resources					INTEGER ::= 128
+maxNrofPUCCH-Resources-1				INTEGER ::= 127
+maxNrofPUCCH-ResourceSets				INTEGER ::= 4		-- Maximum number of PUCCH Resource Sets
+maxNrofPUCCH-ResourceSets-1				INTEGER ::= 3		-- Maximum number of PUCCH Resource Sets minus 1.
+maxNrofPUCCH-ResourcesPerSet			INTEGER ::= 32		-- Maximum number of PUCCH Resources per PUCCH-ResourceSet
+maxNrofPUCCH-ResourcesPerSet-1			INTEGER ::= 31		-- Maximum number of PUCCH Resources per PUCCH-ResourceSet minus 1.
+maxNrofPUCCH-P0-PerSet					INTEGER ::= 8		-- Maximum number of P0-pucch present in a p0-pucch set
+maxNrofPUCCH-PathlossReferenceRSs		INTEGER ::= 4		-- Maximum number of RSs used as pathloss reference for PUCCH power control. 
+maxNrofPUCCH-PathlossReferenceRSs-1		INTEGER ::= 3		-- Maximum number of RSs used as pathloss reference for PUCCH power control minus 1.
+
+maxNrofP0-PUSCH-AlphaSets				INTEGER ::= 30		-- Maximum number of P0-pusch-alpha-sets (see 38,213, section 7.1)
+maxNrofP0-PUSCH-AlphaSets-1				INTEGER ::= 29		-- Maximum number of P0-pusch-alpha-sets minus 1 (see 38,213, section 7.1)
+maxNrofPUSCH-PathlossReferenceRSs		INTEGER ::= 4		-- Maximum number of RSs used as pathloss reference for PUSCH power control. 
+maxNrofPUSCH-PathlossReferenceRSs-1		INTEGER ::= 3		-- Maximum number of RSs used as pathloss reference for PUSCH power control minus 1.
+
+maxBands 								INTEGER ::= 1024		-- Maximum number of supported bands in UE capability.
+maxBandsMRDC							INTEGER	::= 1280
+maxBandsEUTRA							INTEGER ::=	256
+maxCellPrep		 						INTEGER ::= 32
+maxCellReport		 					INTEGER ::= 8
+maxDRB		 							INTEGER ::= 29			-- Maximum number of DRBs (that can be added in DRB-ToAddModLIst).
+maxFreq		 							INTEGER ::= 8			-- Max number of non-serving frequencies in MeasResultSCG-Failure.
+maxNrofCSI-RS	 						INTEGER ::= 64
+maxNrofCandidateBeams 					INTEGER ::= 16			-- Max number of PRACH-ResourceDedicatedBFR that in BFR config.
+maxNrofPCIsPerSMTC 						INTEGER ::= 64			-- Maximun number of PCIs per SMTC.
+maxNrofQFIs 							INTEGER ::= 64
+maxNrofSR-Resources		 				INTEGER ::= 8			-- Maximum number of SR resources per BWP in a cell.
+maxNrofSlotFormatsPerCombination 		INTEGER ::= 256
+maxNrofSpatialRelationInfos 			INTEGER ::= 8
+maxNrofSRS-ResourcesPerSet 				INTEGER ::= 16
+maxNrofIndexesToReport 					INTEGER ::= 32
+maxNrofSSBs 							INTEGER ::= 64 			-- Maximum number of SSB resources in a resource set.
+maxNrofSSBs-1							INTEGER ::= 63			-- Maximum number of SSB resources in a resource set minus 1.
+
+maxNrofTCI-StatesPDCCH 					INTEGER ::= 64
+maxNrofTCI-States						INTEGER ::= 64			-- Maximum number of TCI states.
+maxNrofTCI-States-1						INTEGER ::= 63			-- Maximum number of TCI states minus 1.
+maxNrofUL-Allocations 					INTEGER ::= 16			-- Maximum number of PUSCH time domain resource allocations.
+maxQFI 									INTEGER ::= 63
+maxRA-CSIRS-Resources 					INTEGER ::= 96
+maxRA-OccasionsPerCSIRS					INTEGER ::= 64			-- Maximum number of RA occasions for one CSI-RS
+maxRA-Occasions-1						INTEGER ::=	511			-- Maximum number of RA occasions in the system
+maxRA-SSB-Resources 					INTEGER ::= 64
+maxSCSs									INTEGER ::= 5
+maxSecondaryCellGroups 					INTEGER ::= 3
+maxNrofServingCellsEUTRA				INTEGER ::= 32
+maxMBSFN-Allocations					INTEGER ::= 8
+maxNrofMultiBands						INTEGER ::= 8
+maxCellSFTD    	                    	INTEGER ::= 3  			-- Maximum number of cells for SFTD reporting
+maxReportConfigId                 	 	INTEGER ::= 64
+
+maxNrofSRI-PUSCH-Mappings				INTEGER ::= 16
+maxNrofSRI-PUSCH-Mappings-1				INTEGER ::= 15
+
+-- Editor’s Note: Targeted for completion in June 2018. Not used in EN-DC drop.
+CellIdentity ::=						ENUMERATED {ffsTypeAndValue}
+ShortMAC-I ::=							ENUMERATED {ffsTypeAndValue}
+
+-- TAG-MULTIPLICITY-AND-TYPE-CONSTRAINT-DEFINITIONS-STOP
+
+END
+
diff --git a/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-UE-Variables.asn b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-UE-Variables.asn
new file mode 100755
index 0000000000000000000000000000000000000000..3eeec31891fd642cffb55a28fd5987f81b2daee7
--- /dev/null
+++ b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-UE-Variables.asn
@@ -0,0 +1,46 @@
+NR-UE-Variables DEFINITIONS AUTOMATIC TAGS ::=
+ 
+BEGIN
+
+-- TAG-VAR-MEAS-CONFIG-START
+
+VarMeasConfig ::=					SEQUENCE {
+	-- Measurement identities
+	measIdList							MeasIdToAddModList					OPTIONAL,
+	-- Measurement objects
+	measObjectList						MeasObjectToAddModList				OPTIONAL,
+	-- Reporting configurations
+	reportConfigList					ReportConfigToAddModList			OPTIONAL,
+	-- Other parameters
+	quantityConfig						QuantityConfig						OPTIONAL,
+	
+	s-MeasureConfig							CHOICE {
+		ssb-RSRP								RSRP-Range,						
+		csi-RSRP								RSRP-Range						
+	} 																		OPTIONAL
+
+}
+
+-- TAG-VAR-MEAS-CONFIG-STOP
+-- TAG-VAR-MEAS-REPORT-START
+
+VarMeasReportList ::=				SEQUENCE (SIZE (1..maxNrofMeasId)) OF VarMeasReport
+
+VarMeasReport ::=					SEQUENCE {
+	-- List of measurement that have been triggered
+	measId								MeasId,
+	cellsTriggeredList					CellsTriggeredList				OPTIONAL,
+	numberOfReportsSent					INTEGER
+}
+
+CellsTriggeredList ::=				SEQUENCE (SIZE (1..maxNrofCellMeas)) OF CHOICE {
+	physCellId							PhysCellId,
+--	Not needed for EN-DC.
+	physCellIdEUTRA						ENUMERATED {ffsTypeAndValue}
+	}
+
+
+-- TAG-VAR-MEAS-REPORT-STOP
+
+END
+
diff --git a/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/extract_asn1_from_spce.pl b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/extract_asn1_from_spce.pl
new file mode 100755
index 0000000000000000000000000000000000000000..18f6792a8c870819ba1ceac1641866d6376b0eec
--- /dev/null
+++ b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/extract_asn1_from_spce.pl
@@ -0,0 +1,82 @@
+#!/usr/bin/perl
+# This script extracts the ASN1 definition from and TS 38.331 and generates 3 output files that can be processed by asn2wrs
+# First download the specification from 3gpp.org as a word document and open it
+# Then in "view" menu, select normal or web layout (needed to removed page header and footers)
+# Finally save the document as a text file
+# Call the script: "perl extract_asn1_from_spec.pl 38331-xxx.txt"
+# It should generate: NR-RRC-Definitions.asn, NR-UE-Variables.asn and NR-InterNodeDefinitions
+use warnings;
+$input_file = $ARGV[0];
+$NR_def_output_file = "NR-RRC-Definitions.asn";
+$NR_var_output_file = "NR-UE-Variables.asn";
+$NR_internode_output_file = "NR-InterNodeDefinitions.asn";
+
+
+sub extract_asn1;
+
+open(INPUT_FILE, "< $input_file") or die "Can not open file $input_file";
+
+while (<INPUT_FILE>) {
+
+  # Process the NR-RRC-Definitions section
+  if( m/NR-RRC-Definitions DEFINITIONS AUTOMATIC TAGS ::=/){
+    open(OUTPUT_FILE, "> $NR_def_output_file") or die "Can not open file $def_output_file";
+    syswrite OUTPUT_FILE,"$_ \n";
+    syswrite OUTPUT_FILE,"BEGIN\n\n";
+
+    # Get all the text delimited by -- ASN1START and -- ASN1STOP
+    extract_asn1();
+
+    syswrite OUTPUT_FILE,"END\n\n";
+    close(OUTPUT_FILE);
+  }
+
+  # Process the NR-UE-Variables section
+  if( m/NR-UE-Variables DEFINITIONS AUTOMATIC TAGS ::=/){
+    open(OUTPUT_FILE, "> $NR_var_output_file") or die "Can not open file $def_output_file";
+    syswrite OUTPUT_FILE,"$_ \n";
+    syswrite OUTPUT_FILE,"BEGIN\n\n";
+
+    # Get all the text delimited by -- ASN1START and -- ASN1STOP
+    extract_asn1();
+
+    syswrite OUTPUT_FILE,"END\n\n";
+    close(OUTPUT_FILE);
+  }
+  # Process the NR-InterNodeDefinitions section
+  if( m/NR-InterNodeDefinitions DEFINITIONS AUTOMATIC TAGS ::=/){
+    open(OUTPUT_FILE, "> $NR_internode_output_file") or die "Can not open file $def_output_file";
+    syswrite OUTPUT_FILE,"$_ \n";
+    syswrite OUTPUT_FILE,"BEGIN\n\n";
+
+    # Get all the text delimited by -- ASN1START and -- ASN1STOP
+    extract_asn1();
+
+    syswrite OUTPUT_FILE,"END\n\n";
+    close(OUTPUT_FILE);
+  }
+
+}
+
+close(INPUT_FILE);
+
+# This subroutine copies the text delimited by -- ASN1START and -- ASN1STOP in INPUT_FILE
+# and copies it into OUTPUT_FILE.
+# It stops when it meets the keyword "END"
+sub extract_asn1 {
+  my $line = <INPUT_FILE>;
+  my $is_asn1 = 0;
+
+  while(($line ne "END\n") && ($line ne "END\r\n")){
+    if ($line =~ m/-- ASN1STOP/) {
+      $is_asn1 = 0;
+    }
+    if ($is_asn1 == 1){
+      syswrite OUTPUT_FILE,"$line";
+    }
+    if ($line =~ m/-- ASN1START/) {
+      $is_asn1 = 1;
+    }
+    $line = <INPUT_FILE>;
+  }
+}
diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c
new file mode 100644
index 0000000000000000000000000000000000000000..a05b27ddc361f93e62c6bb6bac70803b662ac152
--- /dev/null
+++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c
@@ -0,0 +1,2667 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file asn1_msg.c
+* \brief primitives to build the asn1 messages
+* \author Raymond Knopp and Navid Nikaein
+* \date 2011
+* \version 1.0
+* \company Eurecom
+* \email: raymond.knopp@eurecom.fr and  navid.nikaein@eurecom.fr
+*/
+
+#ifdef USER_MODE
+#include <stdio.h>
+#include <sys/types.h>
+#include <stdlib.h> /* for atoi(3) */
+#include <unistd.h> /* for getopt(3) */
+#include <string.h> /* for strerror(3) */
+#include <sysexits.h> /* for EX_* exit codes */
+#include <errno.h>  /* for errno */
+#else
+#include <linux/module.h>  /* Needed by all modules */
+#endif
+#ifdef USER_MODE
+//#include "RRC/LITE/defs.h"
+//#include "COMMON/mac_rrc_primitives.h"
+#include "UTIL/LOG/log.h"
+#endif
+#include <asn_application.h>
+#include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */
+#include <per_encoder.h>
+
+#include "assertions.h"
+#include "RRCConnectionRequest.h"
+#include "UL-CCCH-Message.h"
+#include "UL-DCCH-Message.h"
+#include "DL-CCCH-Message.h"
+#include "DL-DCCH-Message.h"
+#include "EstablishmentCause.h"
+#include "RRCConnectionSetup.h"
+#include "SRB-ToAddModList.h"
+#include "DRB-ToAddModList.h"
+#if defined(Rel10) || defined(Rel14)
+#include "MCCH-Message.h"
+//#define MRB1 1
+#endif
+
+#include "RRC/LITE/defs.h"
+#include "RRC/LITE/extern.h"
+#include "RRCConnectionSetupComplete.h"
+#include "RRCConnectionReconfigurationComplete.h"
+#include "RRCConnectionReconfiguration.h"
+#include "MasterInformationBlock.h"
+#include "SystemInformation.h"
+
+#include "SystemInformationBlockType1.h"
+
+#include "SIB-Type.h"
+
+#include "BCCH-DL-SCH-Message.h"
+
+#include "PHY/defs.h"
+
+#include "MeasObjectToAddModList.h"
+#include "ReportConfigToAddModList.h"
+#include "MeasIdToAddModList.h"
+#include "enb_config.h"
+
+#if defined(ENABLE_ITTI)
+# include "intertask_interface.h"
+#endif
+
+#include "common/ran_context.h"
+
+//#include "PHY/defs.h"
+#ifndef USER_MODE
+#define msg printk
+#ifndef errno
+int errno;
+#endif
+#else
+# if !defined (msg)
+#   define msg printf
+# endif
+#endif
+
+//#define XER_PRINT
+
+typedef struct xer_sprint_string_s {
+  char *string;
+  size_t string_size;
+  size_t string_index;
+} xer_sprint_string_t;
+
+extern unsigned char NB_eNB_INST;
+extern uint8_t usim_test;
+
+extern RAN_CONTEXT_t RC;
+
+uint16_t two_tier_hexagonal_cellIds[7] = {0,1,2,4,5,7,8};
+uint16_t two_tier_hexagonal_adjacent_cellIds[7][6] = {{1,2,4,5,7,8},    // CellId 0
+  {11,18,2,0,8,15}, // CellId 1
+  {18,13,3,4,0,1},  // CellId 2
+  {2,3,14,6,5,0},   // CellId 4
+  {0,4,6,16,9,7},   // CellId 5
+  {8,0,5,9,17,12},  // CellId 7
+  {15,1,0,7,12,10}
+};// CellId 8
+
+/*
+ * This is a helper function for xer_sprint, which directs all incoming data
+ * into the provided string.
+ */
+static int xer__print2s (const void *buffer, size_t size, void *app_key)
+{
+  xer_sprint_string_t *string_buffer = (xer_sprint_string_t *) app_key;
+  size_t string_remaining = string_buffer->string_size - string_buffer->string_index;
+
+  if (string_remaining > 0) {
+    if (size > string_remaining) {
+      size = string_remaining;
+    }
+
+    memcpy(&string_buffer->string[string_buffer->string_index], buffer, size);
+    string_buffer->string_index += size;
+  }
+
+  return 0;
+}
+
+int xer_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td, void *sptr)
+{
+  asn_enc_rval_t er;
+  xer_sprint_string_t string_buffer;
+
+  string_buffer.string = string;
+  string_buffer.string_size = string_size;
+  string_buffer.string_index = 0;
+
+  er = xer_encode(td, sptr, XER_F_BASIC, xer__print2s, &string_buffer);
+
+  if (er.encoded < 0) {
+    LOG_E(RRC, "xer_sprint encoding error (%zd)!", er.encoded);
+    er.encoded = string_buffer.string_size;
+  } else {
+    if (er.encoded > string_buffer.string_size) {
+      LOG_E(RRC, "xer_sprint string buffer too small, got %zd need %zd!", string_buffer.string_size, er.encoded);
+      er.encoded = string_buffer.string_size;
+    }
+  }
+
+  return er.encoded;
+}
+
+uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index)
+{
+  return(two_tier_hexagonal_adjacent_cellIds[Mod_id][index]);
+}
+/* This only works for the hexagonal topology...need a more general function for other topologies */
+
+uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId)
+{
+  uint8_t i;
+
+  for(i=0; i<7; i++) {
+    if(two_tier_hexagonal_cellIds[i] == phyCellId) {
+      return i;
+    }
+  }
+
+  LOG_E(RRC,"\nCannot get adjacent cell mod id! Fatal error!\n");
+  return 0xFF; //error!
+}
+
+uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame)
+{
+
+  asn_enc_rval_t enc_rval;
+  BCCH_BCH_Message_t *mib=&carrier->mib ;
+  uint8_t sfn = (uint8_t)((frame>>2)&0xff);
+  uint16_t *spare= calloc(1, sizeof(uint16_t));
+  if (spare == NULL) abort();
+
+  switch (N_RB_DL) {
+
+  case 6:
+    mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n6;
+    break;
+
+  case 15:
+    mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n15;
+    break;
+
+  case 25:
+    mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n25;
+    break;
+
+  case 50:
+    mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n50;
+    break;
+
+  case 75:
+    mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n75;
+    break;
+
+  case 100:
+    mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n100;
+    break;
+  default:
+    AssertFatal(1==0,"Unknown dl_Bandwidth %d\n",N_RB_DL);
+  }
+
+  AssertFatal(phich_Resource <= PHICH_Config__phich_Resource_two,"Illegal phich_Resource\n");
+  mib->message.phich_Config.phich_Resource = phich_Resource;
+  AssertFatal(phich_Resource <= PHICH_Config__phich_Duration_extended,"Illegal phich_Duration\n");
+  mib->message.phich_Config.phich_Duration = phich_duration;
+  LOG_I(RRC,"[MIB] systemBandwidth %x, phich_duration %x, phich_resource %x,sfn %x\n",
+         (uint32_t)mib->message.dl_Bandwidth,
+         (uint32_t)phich_duration,
+         (uint32_t)phich_Resource,
+         (uint32_t)sfn);
+
+  mib->message.systemFrameNumber.buf = &sfn;
+  mib->message.systemFrameNumber.size = 1;
+  mib->message.systemFrameNumber.bits_unused=0;
+  mib->message.spare.buf = (uint8_t *)spare;
+#ifndef Rel14
+  mib->message.spare.size = 2;
+  mib->message.spare.bits_unused = 6;  // This makes a spare of 10 bits
+#else
+  mib->message.spare.size = 1;
+  mib->message.spare.bits_unused = 3;  // This makes a spare of 5 bits
+  mib->message.schedulingInfoSIB1_BR_r13 = 0; // turn off eMTC
+#endif
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
+                                   (void*)mib,
+                                   carrier->MIB,
+                                   24);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+  /*
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_BCH_Message, (void *) &mib)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, enb_module_idP, msg_p);
+    }
+  }
+# endif
+#endif
+  */
+  if (enc_rval.encoded==-1) {
+    return(-1);
+  }
+
+  return((enc_rval.encoded+7)/8);
+}
+
+uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
+		int Mod_id,int CC_id
+#if defined(ENABLE_ITTI)
+                , RrcConfigurationReq *configuration
+#endif
+               )
+{
+
+  //  SystemInformation_t systemInformation;
+  PLMN_IdentityInfo_t PLMN_identity_info;
+  MCC_MNC_Digit_t dummy_mcc[3],dummy_mnc[3];
+  asn_enc_rval_t enc_rval;
+  SchedulingInfo_t schedulingInfo;
+  SIB_Type_t sib_type;
+
+  uint8_t *buffer                      = carrier->SIB1;
+  BCCH_DL_SCH_Message_t *bcch_message  = &carrier->siblock1;
+  SystemInformationBlockType1_t **sib1 = &carrier->sib1;
+
+  
+  memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_t));
+  bcch_message->message.present = BCCH_DL_SCH_MessageType_PR_c1;
+  bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1;
+  //  memcpy(&bcch_message.message.choice.c1.choice.systemInformationBlockType1,sib1,sizeof(SystemInformationBlockType1_t));
+
+  *sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1;
+
+  memset(&PLMN_identity_info,0,sizeof(PLMN_IdentityInfo_t));
+  memset(&schedulingInfo,0,sizeof(SchedulingInfo_t));
+  memset(&sib_type,0,sizeof(SIB_Type_t));
+
+
+
+  PLMN_identity_info.plmn_Identity.mcc = CALLOC(1,sizeof(*PLMN_identity_info.plmn_Identity.mcc));
+  memset(PLMN_identity_info.plmn_Identity.mcc,0,sizeof(*PLMN_identity_info.plmn_Identity.mcc));
+
+  asn_set_empty(&PLMN_identity_info.plmn_Identity.mcc->list);//.size=0;
+
+#if defined(ENABLE_ITTI)
+  dummy_mcc[0] = (configuration->mcc / 100) % 10;
+  dummy_mcc[1] = (configuration->mcc / 10) % 10;
+  dummy_mcc[2] = (configuration->mcc / 1) % 10;
+#else
+  dummy_mcc[0] = 0;
+  dummy_mcc[1] = 0;
+  dummy_mcc[2] = 1;
+#endif
+  ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[0]);
+  ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[1]);
+  ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[2]);
+
+  PLMN_identity_info.plmn_Identity.mnc.list.size=0;
+  PLMN_identity_info.plmn_Identity.mnc.list.count=0;
+#if defined(ENABLE_ITTI)
+
+  if (configuration->mnc >= 100) {
+    dummy_mnc[0] = (configuration->mnc / 100) % 10;
+    dummy_mnc[1] = (configuration->mnc / 10) % 10;
+    dummy_mnc[2] = (configuration->mnc / 1) % 10;
+  } else {
+    if (configuration->mnc_digit_length == 2) {
+      dummy_mnc[0] = (configuration->mnc / 10) % 10;
+      dummy_mnc[1] = (configuration->mnc / 1) % 10;
+      dummy_mnc[2] = 0xf;
+    } else {
+      dummy_mnc[0] = (configuration->mnc / 100) % 100;
+      dummy_mnc[1] = (configuration->mnc / 10) % 10;
+      dummy_mnc[2] = (configuration->mnc / 1) % 10;
+    }
+  }
+
+#else
+  dummy_mnc[0] = 0;
+  dummy_mnc[1] = 1;
+  dummy_mnc[2] = 0xf;
+#endif
+  ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mnc.list,&dummy_mnc[0]);
+  ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mnc.list,&dummy_mnc[1]);
+
+  if (dummy_mnc[2] != 0xf) {
+    ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mnc.list,&dummy_mnc[2]);
+  }
+
+  //assign_enum(&PLMN_identity_info.cellReservedForOperatorUse,PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved);
+  PLMN_identity_info.cellReservedForOperatorUse=PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
+
+  ASN_SEQUENCE_ADD(&(*sib1)->cellAccessRelatedInfo.plmn_IdentityList.list,&PLMN_identity_info);
+
+
+  // 16 bits
+  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf = MALLOC(2);
+#if defined(ENABLE_ITTI)
+  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[0] = (configuration->tac >> 8) & 0xff;
+  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[1] = (configuration->tac >> 0) & 0xff;
+#else
+  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[0] = 0x00;
+  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[1] = 0x01;
+#endif
+  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.size=2;
+  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.bits_unused=0;
+
+  // 28 bits
+  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf = MALLOC(8);
+#if defined(ENABLE_ITTI)
+  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[0] = (configuration->cell_identity >> 20) & 0xff;
+  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[1] = (configuration->cell_identity >> 12) & 0xff;
+  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[2] = (configuration->cell_identity >>  4) & 0xff;
+  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[3] = (configuration->cell_identity <<  4) & 0xf0;
+#else
+  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[0] = 0x00;
+  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[1] = 0x00;
+  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[2] = 0x00;
+  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[3] = 0x10;
+#endif
+  (*sib1)->cellAccessRelatedInfo.cellIdentity.size=4;
+  (*sib1)->cellAccessRelatedInfo.cellIdentity.bits_unused=4;
+
+  //  assign_enum(&(*sib1)->cellAccessRelatedInfo.cellBarred,SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred);
+  (*sib1)->cellAccessRelatedInfo.cellBarred=SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred;
+
+  //  assign_enum(&(*sib1)->cellAccessRelatedInfo.intraFreqReselection,SystemInformationBlockType1__cellAccessRelatedInfo__intraFreqReselection_allowed);
+  (*sib1)->cellAccessRelatedInfo.intraFreqReselection=SystemInformationBlockType1__cellAccessRelatedInfo__intraFreqReselection_notAllowed;
+  (*sib1)->cellAccessRelatedInfo.csg_Indication=0;
+
+  (*sib1)->cellSelectionInfo.q_RxLevMin=-65;
+  (*sib1)->cellSelectionInfo.q_RxLevMinOffset=NULL;
+  //(*sib1)->p_Max = CALLOC(1, sizeof(P_Max_t));
+  //*((*sib1)->p_Max) = 23;
+  (*sib1)->freqBandIndicator =
+#if defined(ENABLE_ITTI)
+    configuration->eutra_band[CC_id];
+#else
+    7;
+#endif
+
+  schedulingInfo.si_Periodicity=SchedulingInfo__si_Periodicity_rf8;
+
+  // This is for SIB2/3
+  sib_type=SIB_Type_sibType3;
+  ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,&sib_type);
+  ASN_SEQUENCE_ADD(&(*sib1)->schedulingInfoList.list,&schedulingInfo);
+
+  //  ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,NULL);
+
+#if defined(ENABLE_ITTI)
+
+  if (configuration->frame_type[CC_id] == TDD)
+#endif
+  {
+    (*sib1)->tdd_Config =                             CALLOC(1,sizeof(struct TDD_Config));
+
+    (*sib1)->tdd_Config->subframeAssignment =
+#if defined(ENABLE_ITTI)
+      configuration->tdd_config[CC_id];
+#else
+      3;
+#endif
+
+    (*sib1)->tdd_Config->specialSubframePatterns =
+#if defined(ENABLE_ITTI)
+      configuration->tdd_config_s[CC_id];
+#else
+    0;
+#endif
+  }
+
+  (*sib1)->si_WindowLength=SystemInformationBlockType1__si_WindowLength_ms20;
+  (*sib1)->systemInfoValueTag=0;
+  //  (*sib1).nonCriticalExtension = calloc(1,sizeof(*(*sib1).nonCriticalExtension));
+
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message,
+                                   (void*)bcch_message,
+                                   buffer,
+                                   100);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[10000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size);
+      itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"[eNB] SystemInformationBlockType1 Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+#endif
+
+  if (enc_rval.encoded==-1) {
+    return(-1);
+  }
+
+  return((enc_rval.encoded+7)/8);
+}
+
+uint8_t do_SIB23(uint8_t Mod_id,
+
+                 int CC_id
+#if defined(ENABLE_ITTI)
+                 , RrcConfigurationReq *configuration
+#endif
+                )
+{
+  struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib2_part,*sib3_part;
+#if defined(Rel10) || defined(Rel14)
+  struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib13_part;
+  MBSFN_SubframeConfigList_t *MBSFNSubframeConfigList;
+  MBSFN_AreaInfoList_r9_t *MBSFNArea_list;
+  struct MBSFN_AreaInfo_r9 *MBSFN_Area1, *MBSFN_Area2;
+#endif
+  asn_enc_rval_t enc_rval;
+
+  uint8_t                           *buffer       = RC.rrc[Mod_id]->carrier[CC_id].SIB23;
+  BCCH_DL_SCH_Message_t             *bcch_message = &RC.rrc[Mod_id]->carrier[CC_id].systemInformation;
+  SystemInformationBlockType2_t     **sib2        = &RC.rrc[Mod_id]->carrier[CC_id].sib2;
+  SystemInformationBlockType3_t     **sib3        = &RC.rrc[Mod_id]->carrier[CC_id].sib3;
+#if defined(Rel10) || defined(Rel14)
+  SystemInformationBlockType13_r9_t **sib13       = &RC.rrc[Mod_id]->carrier[CC_id].sib13;
+  uint8_t                           MBMS_flag     = RC.rrc[Mod_id]->carrier[CC_id].MBMS_flag;
+#endif
+
+  if (bcch_message) {
+    memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_t));
+  } else {
+    LOG_E(RRC,"[eNB %d] BCCH_MESSAGE is null, exiting\n", Mod_id);
+    exit(-1);
+  }
+
+  if (!sib2) {
+    LOG_E(RRC,"[eNB %d] sib2 is null, exiting\n", Mod_id);
+    exit(-1);
+  }
+
+  if (!sib3) {
+    LOG_E(RRC,"[eNB %d] sib3 is null, exiting\n", Mod_id);
+    exit(-1);
+  }
+
+#if defined(Rel10) || defined(Rel14)
+  LOG_I(RRC,"[eNB %d] Configuration SIB2/3, MBMS = %d\n", Mod_id, MBMS_flag);
+#else
+  LOG_I(RRC,"[eNB %d] Configuration SIB2/3\n", Mod_id);
+#endif
+  sib2_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+  sib3_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+  memset(sib2_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+  memset(sib3_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+
+  sib2_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2;
+  sib3_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3;
+
+  *sib2 = &sib2_part->choice.sib2;
+  *sib3 = &sib3_part->choice.sib3;
+
+#if defined(Rel10) || defined(Rel14)
+
+  if (MBMS_flag > 0) {
+    sib13_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+    memset(sib13_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+    sib13_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920;
+    *sib13 = &sib13_part->choice.sib13_v920;
+  }
+
+#endif
+
+  // sib2
+
+  (*sib2)->ac_BarringInfo = NULL;
+#if defined(Rel10) || defined(Rel14)
+#if 0
+  (*sib2)->ssac_BarringForMMTEL_Voice_r9 = NULL;
+  (*sib2)->ssac_BarringForMMTEL_Video_r9 = NULL;
+  (*sib2)->ac_BarringForCSFB_r10 = NULL;
+#endif
+  (*sib2)->ext1 = NULL;
+  (*sib2)->ext2 = NULL;
+#endif
+
+#if defined(ENABLE_ITTI)
+
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles                         = configuration->rach_numberOfRA_Preambles[CC_id];
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig                        = NULL;
+
+  if (configuration->rach_preamblesGroupAConfig[CC_id]) {
+    (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig
+      = CALLOC(1,sizeof(struct RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig));
+    (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA
+      = configuration->rach_sizeOfRA_PreamblesGroupA[CC_id];
+    (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->messageSizeGroupA
+      = configuration->rach_messageSizeGroupA[CC_id];
+    (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->messagePowerOffsetGroupB
+      = configuration->rach_messagePowerOffsetGroupB[CC_id];
+  }
+
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep                   = configuration->rach_powerRampingStep[CC_id];
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower =
+    configuration->rach_preambleInitialReceivedTargetPower[CC_id];
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax                       = configuration->rach_preambleTransMax[CC_id];
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize                  = configuration->rach_raResponseWindowSize[CC_id];
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer          =
+    configuration->rach_macContentionResolutionTimer[CC_id];
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx                                            = configuration->rach_maxHARQ_Msg3Tx[CC_id];
+
+  // BCCH-Config
+  (*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff
+    = configuration->bcch_modificationPeriodCoeff[CC_id];
+
+  // PCCH-Config
+  (*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle
+    = configuration->pcch_defaultPagingCycle[CC_id];
+  (*sib2)->radioResourceConfigCommon.pcch_Config.nB
+    = configuration->pcch_nB[CC_id];
+
+  // PRACH-Config
+  (*sib2)->radioResourceConfigCommon.prach_Config.rootSequenceIndex
+    = configuration->prach_root[CC_id];
+  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex
+    = configuration->prach_config_index[CC_id];
+  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag
+    = configuration->prach_high_speed[CC_id];
+  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig
+    = configuration->prach_zero_correlation[CC_id];
+  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset
+    = configuration->prach_freq_offset[CC_id];
+
+  // PDSCH-Config
+  (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower
+    = configuration->pdsch_referenceSignalPower[CC_id];
+  (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.p_b
+    = configuration->pdsch_p_b[CC_id];
+
+  // PUSCH-Config
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB
+    = configuration->pusch_n_SB[CC_id];
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode
+    = configuration->pusch_hoppingMode[CC_id];
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset
+    = configuration->pusch_hoppingOffset[CC_id];
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM
+    = configuration->pusch_enable64QAM[CC_id];
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled
+    = configuration->pusch_groupHoppingEnabled[CC_id];
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH
+    = configuration->pusch_groupAssignment[CC_id];
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled
+    = configuration->pusch_sequenceHoppingEnabled[CC_id];
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift
+    = configuration->pusch_nDMRS1[CC_id];
+
+  // PUCCH-Config
+
+  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift
+    = configuration->pucch_delta_shift[CC_id];
+  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI
+    = configuration->pucch_nRB_CQI[CC_id];
+  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN
+    = configuration->pucch_nCS_AN[CC_id];
+#if !defined(Rel10) && !defined(Rel14)
+  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN
+    = configuration->pucch_n1_AN[CC_id];
+#endif
+
+  // SRS Config
+  if (configuration->srs_enable[CC_id]==1) {
+    (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present
+      = SoundingRS_UL_ConfigCommon_PR_setup;
+    (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig
+      = configuration->srs_BandwidthConfig[CC_id];
+    (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig
+      = configuration->srs_SubframeConfig[CC_id];
+    (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission
+      = configuration->srs_ackNackST[CC_id];
+
+    if (configuration->srs_MaxUpPts[CC_id]) {
+      (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts
+        = CALLOC(1,sizeof(long));
+      *(*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts=1;
+    } else {
+      (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts = NULL;
+    }
+    RC.rrc[Mod_id]->srs_enable[CC_id] = 1;
+  } else {
+    RC.rrc[Mod_id]->srs_enable[CC_id] = 0;
+    (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present=SoundingRS_UL_ConfigCommon_PR_release;
+    (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.release=0;
+  }
+
+  // uplinkPowerControlCommon
+
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH
+    = configuration->pusch_p0_Nominal[CC_id];
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH
+    = configuration->pucch_p0_Nominal[CC_id];
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.alpha
+    = configuration->pusch_alpha[CC_id];
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1
+    = configuration->pucch_deltaF_Format1[CC_id];
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b
+    = configuration->pucch_deltaF_Format1b[CC_id];
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2
+    = configuration->pucch_deltaF_Format2[CC_id];
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a
+    = configuration->pucch_deltaF_Format2a[CC_id];
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b
+    = configuration->pucch_deltaF_Format2b[CC_id];
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3
+    = configuration->msg3_delta_Preamble[CC_id];
+  (*sib2)->radioResourceConfigCommon.ul_CyclicPrefixLength
+    = configuration->ul_CyclicPrefixLength[CC_id];
+
+  // UE Timers and Constants
+
+  (*sib2)->ue_TimersAndConstants.t300
+    = configuration->ue_TimersAndConstants_t300[CC_id];
+  (*sib2)->ue_TimersAndConstants.t301
+    = configuration->ue_TimersAndConstants_t301[CC_id];
+  (*sib2)->ue_TimersAndConstants.t310
+    = configuration->ue_TimersAndConstants_t310[CC_id];
+  (*sib2)->ue_TimersAndConstants.n310
+    = configuration->ue_TimersAndConstants_n310[CC_id];
+  (*sib2)->ue_TimersAndConstants.t311
+    = configuration->ue_TimersAndConstants_t311[CC_id];
+  (*sib2)->ue_TimersAndConstants.n311
+    = configuration->ue_TimersAndConstants_n311[CC_id];
+
+#else
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles=RACH_ConfigCommon__preambleInfo__numberOfRA_Preambles_n64;
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig = NULL;
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep=RACH_ConfigCommon__powerRampingParameters__powerRampingStep_dB2;
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower=
+    RACH_ConfigCommon__powerRampingParameters__preambleInitialReceivedTargetPower_dBm_100;
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax=RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10;
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize=RACH_ConfigCommon__ra_SupervisionInfo__ra_ResponseWindowSize_sf10;
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer=
+    RACH_ConfigCommon__ra_SupervisionInfo__mac_ContentionResolutionTimer_sf48;
+  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx = 4;
+
+  // BCCH-Config
+  (*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff=BCCH_Config__modificationPeriodCoeff_n2;
+
+  // PCCH-Config
+  (*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle = PCCH_Config__defaultPagingCycle_rf128;
+  (*sib2)->radioResourceConfigCommon.pcch_Config.nB=PCCH_Config__nB_oneT;
+
+  // PRACH-Config
+  (*sib2)->radioResourceConfigCommon.prach_Config.rootSequenceIndex=Mod_id;//0;//384;
+  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex = 0;//3;
+  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag = 0;
+  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig = 1;//12;
+  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset = 2;
+
+  // PDSCH-Config
+  (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower=0;  // corresponds to 24.7 dBm 5 MHz/ 27.7 10 MHz/ 30.7 20 MHz
+
+
+  (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.p_b=0;
+
+  // PUSCH-Config
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB=1;
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode=PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame;
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset=0;
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM=0;
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled=1;
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH=0;
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled=0;
+  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift=0;
+
+  // PUCCH-Config
+
+  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift=PUCCH_ConfigCommon__deltaPUCCH_Shift_ds1;
+  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI = 1;
+  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN = 0;
+  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN = 32;
+
+
+  (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present=SoundingRS_UL_ConfigCommon_PR_release;
+  (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.release=0;
+
+  // uplinkPowerControlCommon
+
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = -108;
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH = -108;
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.alpha=UplinkPowerControlCommon__alpha_al1;
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1=DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF2;
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b=DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF3;
+
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2=DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF0;
+
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a=DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF0;
+
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b=DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0;
+
+  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 = 6;
+
+  (*sib2)->radioResourceConfigCommon.ul_CyclicPrefixLength=UL_CyclicPrefixLength_len1;
+
+  (*sib2)->ue_TimersAndConstants.t300=UE_TimersAndConstants__t300_ms1000;
+
+  (*sib2)->ue_TimersAndConstants.t301=UE_TimersAndConstants__t301_ms1000;
+
+  (*sib2)->ue_TimersAndConstants.t310=UE_TimersAndConstants__t310_ms1000;
+
+  (*sib2)->ue_TimersAndConstants.n310=UE_TimersAndConstants__n310_n20;
+
+  (*sib2)->ue_TimersAndConstants.t311=UE_TimersAndConstants__t311_ms10000;
+
+  (*sib2)->ue_TimersAndConstants.n311=UE_TimersAndConstants__n311_n1;
+
+#endif
+
+  (*sib2)->freqInfo.additionalSpectrumEmission = 1;
+  (*sib2)->freqInfo.ul_CarrierFreq = NULL;
+  (*sib2)->freqInfo.ul_Bandwidth = NULL;
+  //  (*sib2)->mbsfn_SubframeConfigList = NULL;
+
+#if defined(Rel10) || defined(Rel14)
+
+  if (MBMS_flag > 0) {
+    LOG_I(RRC,"Adding MBSFN subframe Configuration 1 to SIB2\n");
+    MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig1;
+    (*sib2)->mbsfn_SubframeConfigList = CALLOC(1,sizeof(struct MBSFN_SubframeConfigList));
+    MBSFNSubframeConfigList = (*sib2)->mbsfn_SubframeConfigList;
+
+    sib2_mbsfn_SubframeConfig1= CALLOC(1,sizeof(*sib2_mbsfn_SubframeConfig1));
+    memset((void*)sib2_mbsfn_SubframeConfig1,0,sizeof(*sib2_mbsfn_SubframeConfig1));
+
+    sib2_mbsfn_SubframeConfig1->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4;
+    sib2_mbsfn_SubframeConfig1->radioframeAllocationOffset= 1;
+    sib2_mbsfn_SubframeConfig1->subframeAllocation.present= MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame;
+    sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(1);
+    sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 1;
+    sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 2;
+
+    sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x38<<2;
+
+    ASN_SEQUENCE_ADD(&MBSFNSubframeConfigList->list,sib2_mbsfn_SubframeConfig1);
+
+    if (MBMS_flag == 4 ) {
+      LOG_I(RRC,"Adding MBSFN subframe Configuration 2 to SIB2\n");
+      MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig2;
+      sib2_mbsfn_SubframeConfig2= CALLOC(1,sizeof(*sib2_mbsfn_SubframeConfig2));
+      memset((void*)sib2_mbsfn_SubframeConfig2,0,sizeof(*sib2_mbsfn_SubframeConfig2));
+
+      sib2_mbsfn_SubframeConfig2->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4;
+      sib2_mbsfn_SubframeConfig2->radioframeAllocationOffset= 1;
+      sib2_mbsfn_SubframeConfig2->subframeAllocation.present= MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame;
+      sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.buf= MALLOC(1);
+      sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.size= 1;
+      sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.bits_unused= 2;
+
+      sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.buf[0]=0x07<<2;
+     
+
+      ASN_SEQUENCE_ADD(&MBSFNSubframeConfigList->list,sib2_mbsfn_SubframeConfig2);
+    }
+  }
+
+#else // no MBMS transmission
+  (*sib2)->mbsfn_SubframeConfigList = NULL;
+#endif
+
+  (*sib2)->timeAlignmentTimerCommon=TimeAlignmentTimer_infinity;//TimeAlignmentTimer_sf5120;
+
+  /// (*SIB3)
+#if defined(Rel10) || defined(Rel14)
+  (*sib3)->ext1 = NULL;
+#if 0
+  (*sib3)->s_IntraSearch_v920=NULL;
+  (*sib3)->s_NonIntraSearch_v920=NULL;
+  (*sib3)->q_QualMin_r9=NULL;
+  (*sib3)->threshServingLowQ_r9=NULL;
+#endif
+#endif
+  (*sib3)->cellReselectionInfoCommon.q_Hyst=SystemInformationBlockType3__cellReselectionInfoCommon__q_Hyst_dB4;
+
+  (*sib3)->cellReselectionInfoCommon.speedStateReselectionPars=NULL;
+
+  (*sib3)->cellReselectionServingFreqInfo.s_NonIntraSearch=NULL;
+  (*sib3)->cellReselectionServingFreqInfo.threshServingLow=31;
+  (*sib3)->cellReselectionServingFreqInfo.cellReselectionPriority=7;
+
+  (*sib3)->intraFreqCellReselectionInfo.q_RxLevMin = -70;
+  (*sib3)->intraFreqCellReselectionInfo.p_Max = NULL;
+  (*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch));
+  *(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = 31;
+  (*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth=CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth));
+
+  *(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth = AllowedMeasBandwidth_mbw6;
+
+  (*sib3)->intraFreqCellReselectionInfo.presenceAntennaPort1 = 0;
+  (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf = CALLOC(8,1);
+  (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.size = 1;
+  (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf[0] = 1;
+  (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.bits_unused = 6;
+  (*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA = 1;
+  (*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF = (struct SpeedStateScaleFactors *)NULL;
+
+  // SIB13
+  // fill in all elements of SIB13 if present
+#if defined(Rel10) || defined(Rel14)
+
+  if (MBMS_flag > 0 ) {
+    //  Notification for mcch change
+    (*sib13)->notificationConfig_r9.notificationRepetitionCoeff_r9= MBMS_NotificationConfig_r9__notificationRepetitionCoeff_r9_n2;
+    (*sib13)->notificationConfig_r9.notificationOffset_r9= 0;
+    (*sib13)->notificationConfig_r9.notificationSF_Index_r9= 1;
+
+    //  MBSFN-AreaInfoList
+    MBSFNArea_list= &(*sib13)->mbsfn_AreaInfoList_r9;//CALLOC(1,sizeof(*MBSFNArea_list));
+    memset(MBSFNArea_list,0,sizeof(*MBSFNArea_list));
+    // MBSFN Area 1
+    MBSFN_Area1= CALLOC(1, sizeof(*MBSFN_Area1));
+    MBSFN_Area1->mbsfn_AreaId_r9= 1;
+    MBSFN_Area1->non_MBSFNregionLength= MBSFN_AreaInfo_r9__non_MBSFNregionLength_s2;
+    MBSFN_Area1->notificationIndicator_r9= 0;
+    MBSFN_Area1->mcch_Config_r9.mcch_RepetitionPeriod_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_RepetitionPeriod_r9_rf32;
+    MBSFN_Area1->mcch_Config_r9.mcch_Offset_r9= 1; // in accordance with mbsfn subframe configuration in sib2
+    MBSFN_Area1->mcch_Config_r9.mcch_ModificationPeriod_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_ModificationPeriod_r9_rf512;
+    //  Subframe Allocation Info
+    MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.buf= MALLOC(1);
+    MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.size= 1;
+
+    MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.buf[0]=0x20<<2;  // FDD: SF1
+    
+
+    MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.bits_unused= 2;
+
+    MBSFN_Area1->mcch_Config_r9.signallingMCS_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__signallingMCS_r9_n7;
+
+    ASN_SEQUENCE_ADD(&MBSFNArea_list->list,MBSFN_Area1);
+
+    //MBSFN Area 2: currently only activated for eMBMS relaying
+    if (MBMS_flag == 4 ) {
+      MBSFN_Area2= CALLOC(1, sizeof(*MBSFN_Area2));
+      MBSFN_Area2->mbsfn_AreaId_r9= 2;
+      MBSFN_Area2->non_MBSFNregionLength= MBSFN_AreaInfo_r9__non_MBSFNregionLength_s2;
+      MBSFN_Area2->notificationIndicator_r9= 1;
+      MBSFN_Area2->mcch_Config_r9.mcch_RepetitionPeriod_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_RepetitionPeriod_r9_rf32;
+      MBSFN_Area2->mcch_Config_r9.mcch_Offset_r9= 1;
+      MBSFN_Area2->mcch_Config_r9.mcch_ModificationPeriod_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_ModificationPeriod_r9_rf512;
+      // Subframe Allocation Info
+      MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.buf= MALLOC(1);
+      MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.size= 1;
+      MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.bits_unused= 2;
+
+      MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.buf[0]=0x04<<2;  // FDD: SF6
+     
+
+      MBSFN_Area2->mcch_Config_r9.signallingMCS_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__signallingMCS_r9_n7;
+
+      ASN_SEQUENCE_ADD(&MBSFNArea_list->list,MBSFN_Area2);
+    }
+
+    //  end of adding for MBMS SIB13
+  }
+
+#endif
+
+  bcch_message->message.present = BCCH_DL_SCH_MessageType_PR_c1;
+  bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType__c1_PR_systemInformation;
+
+  /*  memcpy((void*)&bcch_message.message.choice.c1.choice.systemInformation,
+   (void*)systemInformation,
+   sizeof(SystemInformation_t));*/
+
+  bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.present = SystemInformation__criticalExtensions_PR_systemInformation_r8;
+
+  bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count=0;
+
+  //  asn_set_empty(&systemInformation->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list);//.size=0;
+  //  systemInformation->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count=0;
+  ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list,
+                   sib2_part);
+  ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list,
+                   sib3_part);
+#if defined(Rel10) || defined(Rel14)
+
+  if (MBMS_flag > 0) {
+    ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list,sib13_part);
+  }
+
+#endif
+
+
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message,
+                                   (void*)bcch_message,
+                                   buffer,
+                                   900);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[15000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"[eNB] SystemInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+#endif
+
+  if (enc_rval.encoded==-1) {
+    msg("[RRC] ASN1 : SI encoding failed for SIB23\n");
+    return(-1);
+  }
+
+  return((enc_rval.encoded+7)/8);
+}
+
+uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv)
+{
+
+  asn_enc_rval_t enc_rval;
+  uint8_t buf[5],buf2=0;
+  uint8_t ecause=0;
+
+  UL_CCCH_Message_t ul_ccch_msg;
+
+  RRCConnectionRequest_t *rrcConnectionRequest;
+
+  memset((void *)&ul_ccch_msg,0,sizeof(UL_CCCH_Message_t));
+
+  ul_ccch_msg.message.present           = UL_CCCH_MessageType_PR_c1;
+  ul_ccch_msg.message.choice.c1.present = UL_CCCH_MessageType__c1_PR_rrcConnectionRequest;
+  rrcConnectionRequest          = &ul_ccch_msg.message.choice.c1.choice.rrcConnectionRequest;
+
+  rrcConnectionRequest->criticalExtensions.present = RRCConnectionRequest__criticalExtensions_PR_rrcConnectionRequest_r8;
+
+  if (1) {
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.present = InitialUE_Identity_PR_randomValue;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.size = 5;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.bits_unused = 0;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf = buf;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf[0] = rv[0];
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf[1] = rv[1];
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf[2] = rv[2];
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf[3] = rv[3];
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf[4] = rv[4];
+  } else {
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.present = InitialUE_Identity_PR_s_TMSI;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.mmec.size = 1;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.mmec.bits_unused = 0;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.mmec.buf = buf;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.mmec.buf[0] = 0x12;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.size = 4;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.bits_unused = 0;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.buf = &buf[1];
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.buf[0] = 0x34;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.buf[1] = 0x56;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.buf[2] = 0x78;
+    rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.buf[3] = 0x9a;
+  }
+
+  rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.establishmentCause = EstablishmentCause_mo_Signalling; //EstablishmentCause_mo_Data;
+
+  rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.buf = &buf2;
+  rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.size=1;
+  rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.bits_unused = 7;
+
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_UL_CCCH_Message,
+                                   (void*)&ul_ccch_msg,
+                                   buffer,
+                                   100);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_CCCH_Message, (void *) &ul_ccch_msg)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_CCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_ul_ccch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_ul_ccch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"[UE] RRCConnectionRequest Encoded %zd bits (%zd bytes), ecause %d\n",enc_rval.encoded,(enc_rval.encoded+7)/8,ecause);
+#endif
+
+  return((enc_rval.encoded+7)/8);
+
+}
+
+uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS)
+{
+
+
+  asn_enc_rval_t enc_rval;
+
+  UL_DCCH_Message_t ul_dcch_msg;
+
+  RRCConnectionSetupComplete_t *rrcConnectionSetupComplete;
+
+  memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t));
+
+  ul_dcch_msg.message.present           = UL_DCCH_MessageType_PR_c1;
+  ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete;
+  rrcConnectionSetupComplete            = &ul_dcch_msg.message.choice.c1.choice.rrcConnectionSetupComplete;
+
+  rrcConnectionSetupComplete->rrc_TransactionIdentifier = Transaction_id;
+  rrcConnectionSetupComplete->criticalExtensions.present = RRCConnectionSetupComplete__criticalExtensions_PR_c1;
+  rrcConnectionSetupComplete->criticalExtensions.choice.c1.present = RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8;
+
+  rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.nonCriticalExtension=CALLOC(1,
+      sizeof(*rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.nonCriticalExtension));
+
+  if(usim_test == 0)
+      rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.selectedPLMN_Identity= 2;
+  else
+      rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.selectedPLMN_Identity= 1;
+
+  rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME =
+    NULL;//calloc(1,sizeof(*rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME));
+  /*
+    rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->plmn_Identity=NULL;
+    rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.buf = calloc(2,1);
+    rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.buf[0] = 0x0;
+    rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.buf[1] = 0x1;
+    rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.size=2;
+    rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.bits_unused=0;
+  */
+  memset(&rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.dedicatedInfoNAS,0,sizeof(OCTET_STRING_t));
+  OCTET_STRING_fromBuf(&rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.dedicatedInfoNAS,
+                       dedicatedInfoNAS, dedicatedInfoNASLength);
+
+  /*
+    rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.buf = calloc(1,1);
+    rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.buf[0] = 0x98;
+    rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.size=1;
+    rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.bits_unused=0;
+  */
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
+                                   (void*)&ul_dcch_msg,
+                                   buffer,
+                                   100);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"RRCConnectionSetupComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+#endif
+
+  return((enc_rval.encoded+7)/8);
+
+}
+
+//------------------------------------------------------------------------------
+uint8_t
+do_RRCConnectionReconfigurationComplete(
+  const protocol_ctxt_t* const ctxt_pP,
+  uint8_t* buffer,
+  const uint8_t Transaction_id
+)
+//------------------------------------------------------------------------------
+{
+
+
+  asn_enc_rval_t enc_rval;
+
+  UL_DCCH_Message_t ul_dcch_msg;
+
+  RRCConnectionReconfigurationComplete_t *rrcConnectionReconfigurationComplete;
+
+  memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t));
+
+  ul_dcch_msg.message.present                     = UL_DCCH_MessageType_PR_c1;
+  ul_dcch_msg.message.choice.c1.present           = UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete;
+  rrcConnectionReconfigurationComplete            = &ul_dcch_msg.message.choice.c1.choice.rrcConnectionReconfigurationComplete;
+
+  rrcConnectionReconfigurationComplete->rrc_TransactionIdentifier = Transaction_id;
+  rrcConnectionReconfigurationComplete->criticalExtensions.present =
+    RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8;
+  rrcConnectionReconfigurationComplete->criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.nonCriticalExtension=NULL;
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
+                                   (void*)&ul_dcch_msg,
+                                   buffer,
+                                   100);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"RRCConnectionReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+#endif
+
+  return((enc_rval.encoded+7)/8);
+}
+
+
+//------------------------------------------------------------------------------
+uint8_t
+do_RRCConnectionSetup(
+  const protocol_ctxt_t*     const ctxt_pP,
+  rrc_eNB_ue_context_t*      const ue_context_pP,
+  int                        CC_id,
+  uint8_t*                   const buffer,
+  const uint8_t              transmission_mode,
+  const uint8_t              Transaction_id,
+  SRB_ToAddModList_t  **SRB_configList,
+  struct PhysicalConfigDedicated  **physicalConfigDedicated)
+{
+
+  asn_enc_rval_t enc_rval;
+  uint8_t ecause=0;
+  eNB_RRC_INST *rrc               = RC.rrc[ctxt_pP->module_id];
+  rrc_eNB_carrier_data_t *carrier = &rrc->carrier[CC_id];
+ 
+  long* logicalchannelgroup = NULL;
+  struct SRB_ToAddMod* SRB1_config = NULL;
+  struct SRB_ToAddMod__rlc_Config* SRB1_rlc_config = NULL;
+  struct SRB_ToAddMod__logicalChannelConfig* SRB1_lchan_config = NULL;
+  struct LogicalChannelConfig__ul_SpecificParameters* SRB1_ul_SpecificParameters = NULL;
+
+#ifdef CBA
+  struct PUSCH_CBAConfigDedicated_vlola*  pusch_CBAConfigDedicated_vlola = NULL;
+  long* betaOffset_CBA_Index = NULL;
+  long* cShift_CBA = NULL;
+#endif
+  PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL;
+
+  DL_CCCH_Message_t dl_ccch_msg;
+
+  RRCConnectionSetup_t* rrcConnectionSetup = NULL;
+
+  memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t));
+  dl_ccch_msg.message.present           = DL_CCCH_MessageType_PR_c1;
+  dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionSetup;
+  rrcConnectionSetup          = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionSetup;
+
+  // RRCConnectionSetup
+  // Configure SRB1
+
+  //  *SRB_configList = CALLOC(1,sizeof(*SRB_configList));
+  if (*SRB_configList) {
+    free(*SRB_configList);
+  }
+
+  *SRB_configList = CALLOC(1,sizeof(SRB_ToAddModList_t));
+
+  /// SRB1
+  SRB1_config = CALLOC(1,sizeof(*SRB1_config));
+
+  SRB1_config->srb_Identity = 1;
+  SRB1_rlc_config = CALLOC(1,sizeof(*SRB1_rlc_config));
+  SRB1_config->rlc_Config   = SRB1_rlc_config;
+
+  SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue;
+  SRB1_rlc_config->choice.explicitValue.present=RLC_Config_PR_am;
+#if defined(ENABLE_ITTI)
+  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = rrc->srb1_timer_poll_retransmit;
+  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU          = rrc->srb1_poll_pdu;
+  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte         = rrc->srb1_poll_byte;
+  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = rrc->srb1_max_retx_threshold;
+  SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering     = rrc->srb1_timer_reordering;
+  SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = rrc->srb1_timer_status_prohibit;
+#else 
+  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms20;;
+  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU          = PollPDU_p4;;
+  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte         = PollByte_kBinfinity;
+  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8;
+  SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering     = T_Reordering_ms35;
+  SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms0;
+#endif 
+
+  SRB1_lchan_config = CALLOC(1,sizeof(*SRB1_lchan_config));
+  SRB1_config->logicalChannelConfig   = SRB1_lchan_config;
+
+  SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue;
+  SRB1_ul_SpecificParameters = CALLOC(1,sizeof(*SRB1_ul_SpecificParameters));
+
+  SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters;
+
+
+  SRB1_ul_SpecificParameters->priority = 1;
+
+  //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity);
+  SRB1_ul_SpecificParameters->prioritisedBitRate=LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+
+  //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50);
+  SRB1_ul_SpecificParameters->bucketSizeDuration=LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+  logicalchannelgroup = CALLOC(1,sizeof(long));
+  *logicalchannelgroup=0;
+  SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup;
+
+
+  ASN_SEQUENCE_ADD(&(*SRB_configList)->list,SRB1_config);
+
+  // PhysicalConfigDedicated
+
+  physicalConfigDedicated2 = CALLOC(1,sizeof(*physicalConfigDedicated2));
+  *physicalConfigDedicated = physicalConfigDedicated2;
+
+  physicalConfigDedicated2->pdsch_ConfigDedicated         = CALLOC(1,sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated));
+  physicalConfigDedicated2->pucch_ConfigDedicated         = CALLOC(1,sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated));
+  physicalConfigDedicated2->pusch_ConfigDedicated         = CALLOC(1,sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated));
+  physicalConfigDedicated2->uplinkPowerControlDedicated   = CALLOC(1,sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated));
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH         = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH));
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH         = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH));
+  physicalConfigDedicated2->cqi_ReportConfig              = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig));
+  if (rrc->srs_enable[CC_id]==1)
+    physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated));
+  else
+    physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL;
+  physicalConfigDedicated2->antennaInfo                   = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo));
+  physicalConfigDedicated2->schedulingRequestConfig       = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig));
+
+  // PDSCH
+  //assign_enum(&physicalConfigDedicated2->pdsch_ConfigDedicated->p_a,
+  //        PDSCH_ConfigDedicated__p_a_dB0);
+  if (carrier->p_eNB==2)
+    physicalConfigDedicated2->pdsch_ConfigDedicated->p_a=   PDSCH_ConfigDedicated__p_a_dB_3;
+  else
+    physicalConfigDedicated2->pdsch_ConfigDedicated->p_a=   PDSCH_ConfigDedicated__p_a_dB0;
+
+  // PUCCH
+  physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.present=PUCCH_ConfigDedicated__ackNackRepetition_PR_release;
+  physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.choice.release=0;
+
+  if (carrier->sib1->tdd_Config == NULL) {
+    physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode=NULL;//PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing;
+  } else { //TDD
+    physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode= CALLOC(1,sizeof(long));
+    *(physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode) =
+      PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_bundling;//PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing;
+  }
+
+  // Pusch_config_dedicated
+  physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 0; // 2.00
+  physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index  = 0; // 1.25
+  physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 8; // 2.25
+
+  // UplinkPowerControlDedicated
+  physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUSCH = 0; // 0 dB
+  //assign_enum(&physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled,
+  // UplinkPowerControlDedicated__deltaMCS_Enabled_en1);
+  physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled= UplinkPowerControlDedicated__deltaMCS_Enabled_en1;
+  physicalConfigDedicated2->uplinkPowerControlDedicated->accumulationEnabled = 1;  // TRUE
+  physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUCCH = 0; // 0 dB
+  physicalConfigDedicated2->uplinkPowerControlDedicated->pSRS_Offset = 0; // 0 dB
+  physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = CALLOC(1,
+      sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient));
+  //  assign_enum(physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient,FilterCoefficient_fc4); // fc4 dB
+  *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient=FilterCoefficient_fc4; // fc4 dB
+
+  // TPC-PDCCH-Config
+
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->present=TPC_PDCCH_Config_PR_setup;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf=CALLOC(1,2);
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.size=2;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[0]=0x12;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[1]=0x34+ue_context_pP->local_uid;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.bits_unused=0;
+
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->present=TPC_PDCCH_Config_PR_setup;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf=CALLOC(1,2);
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.size=2;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[0]=0x22;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[1]=0x34+ue_context_pP->local_uid;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.bits_unused=0;
+
+  // CQI ReportConfig
+
+  physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic));
+#if defined(Rel10) || defined(Rel14)
+  *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic= CQI_ReportModeAperiodic_rm30;
+#else
+  *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CQI_ReportConfig__cqi_ReportModeAperiodic_rm30; // HLC CQI, no PMI
+#endif
+  physicalConfigDedicated2->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0; // 0 dB
+  //physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=NULL;
+  
+  physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic));
+  physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present =  CQI_ReportPeriodic_PR_release;
+    /*
+    physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present =  CQI_ReportPeriodic_PR_setup;
+    physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0;  // n2_pucch
+    physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex = 0;  // Icqi/pmi
+    physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present = CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI;  // subband CQI
+    physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k=4;
+
+    physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL;
+    physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0;
+    */
+
+  //soundingRS-UL-ConfigDedicated
+  if (rrc->srs_enable[CC_id]==1) {
+    physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup;
+    physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth =
+                                                             SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0;
+    physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth =
+          SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0;
+    physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0;
+    physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1;
+    if (carrier->sib1->tdd_Config==NULL) { // FDD
+      if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present
+	  == SoundingRS_UL_ConfigCommon_PR_setup)
+	if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=0) 
+	  LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %zd. Expect undefined behaviour!\n",
+		carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig);
+      if (ue_context_pP->local_uid >=20) 
+	LOG_W(RRC,"This code has been optimized for up to 10 UEs, but current UE_id is %d. Expect undefined behaviour!\n",
+	      ue_context_pP->local_uid);
+      //the current code will allow for 20 UEs - to be revised for more
+      physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=7+ue_context_pP->local_uid/2;
+      physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb= ue_context_pP->local_uid%2;
+    }
+    else {
+      if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present
+	  == SoundingRS_UL_ConfigCommon_PR_setup)
+	if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=7) {
+	  LOG_W(RRC,"This code has been optimized for SRS Subframe Config 7 and TDD config 3, but current configs are %zd and %zd. Expect undefined behaviour!\n",
+		carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig,
+		carrier->sib1->tdd_Config->subframeAssignment);
+	}
+      if (ue_context_pP->local_uid >=6) 
+	LOG_W(RRC,"This code has been optimized for up to 6 UEs, but current UE_id is %d. Expect undefined behaviour!\n",
+	      ue_context_pP->local_uid);
+      physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=17+ue_context_pP->local_uid/2;
+      physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb= ue_context_pP->local_uid%2;
+    }
+    LOG_W(RRC,"local UID %d, srs ConfigIndex %zd, TransmissionComb %zd\n",ue_context_pP->local_uid,
+	  physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex,
+	  physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb);
+
+    physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift=
+          SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0;
+  }
+
+
+  //AntennaInfoDedicated
+  physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo));
+  physicalConfigDedicated2->antennaInfo->present = PhysicalConfigDedicated__antennaInfo_PR_explicitValue;
+  //assign_enum(&physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode,
+  //     AntennaInfoDedicated__transmissionMode_tm2);
+
+  switch (transmission_mode) {
+  default:
+    LOG_W(RRC,"At RRCConnectionSetup Transmission mode can only take values 1 or 2! Defaulting to 1!\n");
+  case 1:
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm1;
+    break;
+
+  case 2:
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm2;
+    break;
+    /*
+  case 3:
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm3;
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     CALLOC(1,
+        sizeof(*physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction));
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+      AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
+
+    break;
+
+  case 4:
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm4;
+    break;
+
+  case 5:
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm5;
+    break;
+
+  case 6:
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm6;
+    break;
+
+  case 7:
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm7;
+    break;
+    */
+  }
+
+
+  physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.present = AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release;
+  physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.release = 0;
+
+  // SchedulingRequestConfig
+
+  physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup;
+  physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 71 - ue_context_pP->local_uid/10;//ue_context_pP->local_uid;
+
+  if (carrier->sib1->tdd_Config == NULL) { // FDD
+    physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5+(ue_context_pP->local_uid%10);  // Isr = 5 (every 10 subframes, offset=2+UE_id mod3)
+  } else {
+    switch (carrier->sib1->tdd_Config->subframeAssignment) {
+    case 1:
+      physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+(ue_context_pP->local_uid&1)+((
+            ue_context_pP->local_uid&3)>>1)*5;  // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..)
+      break;
+
+    case 3:
+      physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+
+          (ue_context_pP->local_uid%3);  // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..)
+      break;
+
+    case 4:
+      physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+
+          (ue_context_pP->local_uid&1);  // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..)
+      break;
+
+    default:
+      physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7;  // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..)
+      break;
+    }
+  }
+
+  //  assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax,
+  //SchedulingRequestConfig__setup__dsr_TransMax_n4);
+  //  assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4;
+  physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4;
+
+  rrcConnectionSetup->rrc_TransactionIdentifier = Transaction_id;
+  rrcConnectionSetup->criticalExtensions.present = RRCConnectionSetup__criticalExtensions_PR_c1;
+  rrcConnectionSetup->criticalExtensions.choice.c1.present =RRCConnectionSetup__criticalExtensions__c1_PR_rrcConnectionSetup_r8 ;
+  rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.srb_ToAddModList = *SRB_configList;
+  rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.drb_ToAddModList = NULL;
+  rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.drb_ToReleaseList = NULL;
+  rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.sps_Config = NULL;
+  rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.physicalConfigDedicated = physicalConfigDedicated2;
+  rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.mac_MainConfig = NULL;
+#ifdef CBA
+  betaOffset_CBA_Index = CALLOC(1,sizeof(long));
+  cShift_CBA = CALLOC(1,sizeof(long));
+  *betaOffset_CBA_Index=10; // need to be changed by Kaijie
+  *cShift_CBA=4;
+  physicalConfigDedicated2->pusch_CBAConfigDedicated_vlola->betaOffset_CBA_Index=betaOffset_CBA_Index;
+  physicalConfigDedicated2->pusch_CBAConfigDedicated_vlola->cShift_CBA=cShift_CBA;
+  rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.sps_CBA_ConfigList_vlola = NULL;
+#endif
+
+
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
+                                   (void*)&dl_ccch_msg,
+                                   buffer,
+                                   100);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"RRCConnectionSetup Encoded %zd bits (%zd bytes), ecause %d\n",
+        enc_rval.encoded,(enc_rval.encoded+7)/8,ecause);
+#endif
+
+  //  FREEMEM(SRB_list);
+  //  free(SRB1_config);
+  //  free(SRB1_rlc_config);
+  //  free(SRB1_lchan_config);
+  //  free(SRB1_ul_SpecificParameters);
+
+  return((enc_rval.encoded+7)/8);
+}
+
+//------------------------------------------------------------------------------
+uint8_t
+do_SecurityModeCommand(
+  const protocol_ctxt_t* const ctxt_pP,
+  uint8_t* const buffer,
+  const uint8_t Transaction_id,
+  const uint8_t cipheringAlgorithm,
+  const uint8_t integrityProtAlgorithm
+)
+//------------------------------------------------------------------------------
+{
+  DL_DCCH_Message_t dl_dcch_msg;
+  asn_enc_rval_t enc_rval;
+
+  memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t));
+
+  dl_dcch_msg.message.present           = DL_DCCH_MessageType_PR_c1;
+  dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_securityModeCommand;
+
+  dl_dcch_msg.message.choice.c1.choice.securityModeCommand.rrc_TransactionIdentifier = Transaction_id;
+  dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.present = SecurityModeCommand__criticalExtensions_PR_c1;
+
+  dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.choice.c1.present =
+    SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8;
+  // the two following information could be based on the mod_id
+  dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm
+    = (CipheringAlgorithm_r12_t)cipheringAlgorithm;
+  dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm
+    = (e_SecurityAlgorithmConfig__integrityProtAlgorithm)integrityProtAlgorithm;
+
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
+                                   (void*)&dl_dcch_msg,
+                                   buffer,
+                                   100);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"[eNB %d] securityModeCommand for UE %x Encoded %zd bits (%zd bytes)\n",
+        ctxt_pP->module_id,
+        ctxt_pP->rnti,
+        enc_rval.encoded,
+        (enc_rval.encoded+7)/8);
+#endif
+
+  if (enc_rval.encoded==-1) {
+    LOG_E(RRC,"[eNB %d] ASN1 : securityModeCommand encoding failed for UE %x\n",
+          ctxt_pP->module_id,
+          ctxt_pP->rnti);
+    return(-1);
+  }
+
+  //  rrc_ue_process_ueCapabilityEnquiry(0,1000,&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry,0);
+  //  exit(-1);
+  return((enc_rval.encoded+7)/8);
+}
+
+//------------------------------------------------------------------------------
+uint8_t
+do_UECapabilityEnquiry(
+  const protocol_ctxt_t* const ctxt_pP,
+  uint8_t*               const buffer,
+  const uint8_t                Transaction_id
+)
+//------------------------------------------------------------------------------
+{
+
+  DL_DCCH_Message_t dl_dcch_msg;
+
+  RAT_Type_t rat=RAT_Type_eutra;
+  asn_enc_rval_t enc_rval;
+
+  memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t));
+
+  dl_dcch_msg.message.present           = DL_DCCH_MessageType_PR_c1;
+  dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry;
+
+  dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.rrc_TransactionIdentifier = Transaction_id;
+
+  dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.present = UECapabilityEnquiry__criticalExtensions_PR_c1;
+  dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.present =
+    UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8;
+  dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count=0;
+  ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list,
+                   &rat);
+
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
+                                   (void*)&dl_dcch_msg,
+                                   buffer,
+                                   100);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"[eNB %d] UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)\n",
+        ctxt_pP->module_id,
+        ctxt_pP->rnti,
+        enc_rval.encoded,
+        (enc_rval.encoded+7)/8);
+#endif
+
+  if (enc_rval.encoded==-1) {
+    LOG_E(RRC,"[eNB %d] ASN1 : UECapabilityRequest encoding failed for UE %x\n",
+          ctxt_pP->module_id,
+          ctxt_pP->rnti);
+    return(-1);
+  }
+
+  return((enc_rval.encoded+7)/8);
+}
+
+//------------------------------------------------------------------------------
+uint16_t
+do_RRCConnectionReconfiguration(
+  const protocol_ctxt_t*        const ctxt_pP,
+  uint8_t                            *buffer,
+  uint8_t                             Transaction_id,
+  SRB_ToAddModList_t                 *SRB_list,
+  DRB_ToAddModList_t                 *DRB_list,
+  DRB_ToReleaseList_t                *DRB_list2,
+  struct SPS_Config                  *sps_Config,
+  struct PhysicalConfigDedicated     *physicalConfigDedicated,
+  MeasObjectToAddModList_t           *MeasObj_list,
+  ReportConfigToAddModList_t         *ReportConfig_list,
+  QuantityConfig_t                   *quantityConfig,
+  MeasIdToAddModList_t               *MeasId_list,
+  MAC_MainConfig_t                   *mac_MainConfig,
+  MeasGapConfig_t                    *measGapConfig,
+  MobilityControlInfo_t              *mobilityInfo,
+  struct MeasConfig__speedStatePars  *speedStatePars,
+  RSRP_Range_t                       *rsrp,
+  C_RNTI_t                           *cba_rnti,
+  struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList
+  *dedicatedInfoNASList
+
+#if defined(Rel10) || defined(Rel14)
+  , SCellToAddMod_r10_t  *SCell_config
+#endif
+)
+//------------------------------------------------------------------------------
+{
+
+  asn_enc_rval_t enc_rval;
+
+  DL_DCCH_Message_t dl_dcch_msg;
+  RRCConnectionReconfiguration_t *rrcConnectionReconfiguration;
+
+
+  memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t));
+
+  dl_dcch_msg.message.present           = DL_DCCH_MessageType_PR_c1;
+  dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration;
+  rrcConnectionReconfiguration          = &dl_dcch_msg.message.choice.c1.choice.rrcConnectionReconfiguration;
+
+  // RRCConnectionReconfiguration
+  rrcConnectionReconfiguration->rrc_TransactionIdentifier = Transaction_id;
+  rrcConnectionReconfiguration->criticalExtensions.present = RRCConnectionReconfiguration__criticalExtensions_PR_c1;
+  rrcConnectionReconfiguration->criticalExtensions.choice.c1.present =RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8 ;
+
+  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated = CALLOC(1,
+      sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated));
+  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList = SRB_list;
+  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList = DRB_list;
+  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToReleaseList = DRB_list2;
+  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->sps_Config = sps_Config;
+  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->physicalConfigDedicated = physicalConfigDedicated;
+#ifdef CBA
+  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->cba_RNTI_vlola= cba_rnti;
+#endif
+
+  if (mac_MainConfig!=NULL) {
+    rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig = CALLOC(1,
+        sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig));
+    rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig->present
+      =RadioResourceConfigDedicated__mac_MainConfig_PR_explicitValue;
+    memcpy(&rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue,
+           mac_MainConfig,
+           sizeof(*mac_MainConfig));
+  } else {
+    rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig=NULL;
+  }
+
+  if (MeasId_list != NULL) {
+    rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig           = CALLOC(1,
+        sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig));
+    memset((void*)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig,
+           0, sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig));
+
+    rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list;
+    rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList       = MeasId_list;
+    rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList   = MeasObj_list;
+
+    if (quantityConfig!=NULL) {
+      rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig = CALLOC(1,
+          sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig));
+      memcpy((void *)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig,
+             (void *)quantityConfig,
+             sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig));
+    } else {
+      rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig = NULL;
+    }
+
+    if(speedStatePars != NULL) {
+      rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars = CALLOC(1,
+          sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars));
+      memcpy((void *)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars,
+             (void *)speedStatePars,sizeof(*speedStatePars));
+    } else {
+      rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars = NULL;
+    }
+
+    rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->s_Measure= rsrp;
+  } else {
+    rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig = NULL;
+  }
+
+  if (mobilityInfo !=NULL) {
+    rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo = CALLOC(1,
+        sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo));
+    memcpy((void*)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo, (void*)mobilityInfo,
+           sizeof(MobilityControlInfo_t));
+
+  } else {
+    rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo  = NULL;
+  }
+
+  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.dedicatedInfoNASList = dedicatedInfoNASList;
+  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.securityConfigHO     = NULL;
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
+                                   (void*)&dl_dcch_msg,
+                                   buffer,
+                                   RRC_BUF_SIZE);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %zd)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#ifdef XER_PRINT
+  xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)&dl_dcch_msg);
+#endif
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[30000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
+    }
+  }
+# endif
+#endif
+
+  //#ifdef USER_MODE
+  LOG_I(RRC,"RRCConnectionReconfiguration Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+  // for (i=0;i<30;i++)
+  //    msg("%x.",buffer[i]);
+  // msg("\n");
+
+  //#endif
+
+  return((enc_rval.encoded+7)/8);
+}
+
+//------------------------------------------------------------------------------
+uint8_t
+do_RRCConnectionReestablishmentReject(
+  uint8_t                    Mod_id,
+  uint8_t*                   const buffer)
+//------------------------------------------------------------------------------
+{
+
+  asn_enc_rval_t enc_rval;
+
+  DL_CCCH_Message_t dl_ccch_msg;
+  RRCConnectionReestablishmentReject_t *rrcConnectionReestablishmentReject;
+
+  memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t));
+  dl_ccch_msg.message.present           = DL_CCCH_MessageType_PR_c1;
+  dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject;
+  rrcConnectionReestablishmentReject    = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionReestablishmentReject;
+
+  // RRCConnectionReestablishmentReject
+  rrcConnectionReestablishmentReject->criticalExtensions.present = RRCConnectionReestablishmentReject__criticalExtensions_PR_rrcConnectionReestablishmentReject_r8;
+
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
+                                   (void*)&dl_ccch_msg,
+                                   buffer,
+                                   100);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"RRCConnectionReestablishmentReject Encoded %zd bits (%zd bytes)\n",
+        enc_rval.encoded,(enc_rval.encoded+7)/8);
+#endif
+
+  return((enc_rval.encoded+7)/8);
+}
+
+//------------------------------------------------------------------------------
+uint8_t
+do_RRCConnectionReject(
+  uint8_t                    Mod_id,
+  uint8_t*                   const buffer)
+//------------------------------------------------------------------------------
+{
+
+  asn_enc_rval_t enc_rval;
+
+  DL_CCCH_Message_t dl_ccch_msg;
+  RRCConnectionReject_t *rrcConnectionReject;
+
+  memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t));
+  dl_ccch_msg.message.present           = DL_CCCH_MessageType_PR_c1;
+  dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionReject;
+  rrcConnectionReject                   = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionReject;
+
+  // RRCConnectionReject
+  rrcConnectionReject->criticalExtensions.present = RRCConnectionReject__criticalExtensions_PR_c1;
+  rrcConnectionReject->criticalExtensions.choice.c1.present = RRCConnectionReject__criticalExtensions__c1_PR_rrcConnectionReject_r8;
+  /* let's put a wait time of 1s for the moment */
+  rrcConnectionReject->criticalExtensions.choice.c1.choice.rrcConnectionReject_r8.waitTime = 1;
+
+#ifdef XER_PRINT
+  xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
+                                   (void*)&dl_ccch_msg,
+                                   buffer,
+                                   100);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %ld)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"RRCConnectionReject Encoded %zd bits (%zd bytes)\n",
+        enc_rval.encoded,(enc_rval.encoded+7)/8);
+#endif
+
+  return((enc_rval.encoded+7)/8);
+}
+
+uint8_t do_RRCConnectionRelease(
+  uint8_t                             Mod_id,
+  uint8_t                            *buffer,
+  uint8_t                             Transaction_id)
+{
+
+  asn_enc_rval_t enc_rval;
+
+  DL_DCCH_Message_t dl_dcch_msg;
+  RRCConnectionRelease_t *rrcConnectionRelease;
+
+
+  memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t));
+
+  dl_dcch_msg.message.present           = DL_DCCH_MessageType_PR_c1;
+  dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_rrcConnectionRelease;
+  rrcConnectionRelease                  = &dl_dcch_msg.message.choice.c1.choice.rrcConnectionRelease;
+
+  // RRCConnectionRelease
+  rrcConnectionRelease->rrc_TransactionIdentifier = Transaction_id;
+  rrcConnectionRelease->criticalExtensions.present = RRCConnectionRelease__criticalExtensions_PR_c1;
+  rrcConnectionRelease->criticalExtensions.choice.c1.present =RRCConnectionRelease__criticalExtensions__c1_PR_rrcConnectionRelease_r8 ;
+
+  rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.releaseCause = ReleaseCause_other;
+  rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.redirectedCarrierInfo = NULL;
+  rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.idleModeMobilityControlInfo = NULL;
+
+  rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension=CALLOC(1,
+      sizeof(*rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension));
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
+                                   (void*)&dl_dcch_msg,
+                                   buffer,
+                                   RRC_BUF_SIZE);
+
+  return((enc_rval.encoded+7)/8);
+}
+
+uint8_t TMGI[5] = {4,3,2,1,0};//TMGI is a string of octet, ref. TS 24.008 fig. 10.5.4a
+
+
+#if defined(Rel10) || defined(Rel14)
+uint8_t do_MBSFNAreaConfig(uint8_t Mod_id,
+                           uint8_t sync_area,
+                           uint8_t *buffer,
+                           MCCH_Message_t *mcch_message,
+                           MBSFNAreaConfiguration_r9_t **mbsfnAreaConfiguration)
+{
+
+  asn_enc_rval_t enc_rval;
+  MBSFN_SubframeConfig_t *mbsfn_SubframeConfig1;
+  PMCH_Info_r9_t *pmch_Info_1;
+  MBMS_SessionInfo_r9_t *mbms_Session_1;
+  // MBMS_SessionInfo_r9_t *mbms_Session_2;
+  eNB_RRC_INST *rrc               = RC.rrc[Mod_id];
+  rrc_eNB_carrier_data_t *carrier = &rrc->carrier[0];
+ 
+
+  memset(mcch_message,0,sizeof(MCCH_Message_t));
+  mcch_message->message.present = MCCH_MessageType_PR_c1;
+  mcch_message->message.choice.c1.present = MCCH_MessageType__c1_PR_mbsfnAreaConfiguration_r9;
+  *mbsfnAreaConfiguration = &mcch_message->message.choice.c1.choice.mbsfnAreaConfiguration_r9;
+
+  // Common Subframe Allocation (CommonSF-Alloc-r9)
+
+  mbsfn_SubframeConfig1= CALLOC(1,sizeof(*mbsfn_SubframeConfig1));
+  memset((void*)mbsfn_SubframeConfig1,0,sizeof(*mbsfn_SubframeConfig1));
+  //
+  mbsfn_SubframeConfig1->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4;
+  mbsfn_SubframeConfig1->radioframeAllocationOffset= 1;
+  mbsfn_SubframeConfig1->subframeAllocation.present= MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame;
+  mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(1);
+  mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 1;
+  mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 2;
+
+  // CURRENTLY WE ARE SUPPORITNG ONLY ONE sf ALLOCATION
+  switch (sync_area) {
+  case 0:
+    if (carrier->sib1->tdd_Config != NULL) {// pattern 001110 for TDD
+      mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x08<<2;// shift 2bits cuz 2last bits are unused.
+    } else { //111000
+      mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x38<<2;
+    }
+
+    break;
+
+  case 1:
+    if (carrier->sib1->tdd_Config != NULL) {
+      mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x08<<2;// shift 2bits cuz 2last bits are unused.
+    } else { // 000111
+      mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x07<<2;
+    }
+
+  default :
+    break;
+  }
+
+  ASN_SEQUENCE_ADD(&(*mbsfnAreaConfiguration)->commonSF_Alloc_r9.list,mbsfn_SubframeConfig1);
+
+  //  commonSF-AllocPeriod-r9
+  (*mbsfnAreaConfiguration)->commonSF_AllocPeriod_r9= MBSFNAreaConfiguration_r9__commonSF_AllocPeriod_r9_rf16;
+
+  // PMCHs Information List (PMCH-InfoList-r9)
+  // PMCH_1  Config
+  pmch_Info_1 = CALLOC(1,sizeof(PMCH_Info_r9_t));
+  memset((void*)pmch_Info_1,0,sizeof(PMCH_Info_r9_t));
+
+  /*
+   * take the value of last mbsfn subframe in this CSA period because there is only one PMCH in this mbsfn area
+   * Note: this has to be set based on the subframeAllocation and CSA
+   */
+  pmch_Info_1->pmch_Config_r9.sf_AllocEnd_r9= 3;
+  pmch_Info_1->pmch_Config_r9.dataMCS_r9= 7;
+  pmch_Info_1->pmch_Config_r9.mch_SchedulingPeriod_r9= PMCH_Config_r9__mch_SchedulingPeriod_r9_rf16;
+
+  // MBMSs-SessionInfoList-r9
+  //  pmch_Info_1->mbms_SessionInfoList_r9 = CALLOC(1,sizeof(struct MBMS_SessionInfoList_r9));
+  //  Session 1
+  mbms_Session_1 = CALLOC(1,sizeof(MBMS_SessionInfo_r9_t));
+  memset(mbms_Session_1,0,sizeof(MBMS_SessionInfo_r9_t));
+  // TMGI value
+  mbms_Session_1->tmgi_r9.plmn_Id_r9.present= TMGI_r9__plmn_Id_r9_PR_plmn_Index_r9;
+  mbms_Session_1->tmgi_r9.plmn_Id_r9.choice.plmn_Index_r9= 1;
+  // Service ID
+  memset(&mbms_Session_1->tmgi_r9.serviceId_r9,0,sizeof(OCTET_STRING_t));// need to check
+  OCTET_STRING_fromBuf(&mbms_Session_1->tmgi_r9.serviceId_r9,(const char*)&TMGI[2],3);
+  // Session ID is still missing here, it can be used as an rab id or mrb id
+  mbms_Session_1->sessionId_r9 = CALLOC(1,sizeof(OCTET_STRING_t));
+  mbms_Session_1->sessionId_r9->buf= MALLOC(1);
+  mbms_Session_1->sessionId_r9->size= 1;
+  mbms_Session_1->sessionId_r9->buf[0]= MTCH;
+  // Logical Channel ID
+  mbms_Session_1->logicalChannelIdentity_r9= MTCH;
+  ASN_SEQUENCE_ADD(&pmch_Info_1->mbms_SessionInfoList_r9.list,mbms_Session_1);
+
+  /*    //  Session 2
+  //mbms_Session_2 = CALLOC(1,sizeof(MBMS_SessionInfo_r9_t));
+  memset(mbms_Session_2,0,sizeof(MBMS_SessionInfo_r9_t));
+  // TMGI value
+  mbms_Session_2->tmgi_r9.plmn_Id_r9.present= TMGI_r9__plmn_Id_r9_PR_plmn_Index_r9;
+  mbms_Session_2->tmgi_r9.plmn_Id_r9.choice.plmn_Index_r9= 1;
+  // Service ID
+  memset(&mbms_Session_2->tmgi_r9.serviceId_r9,0,sizeof(OCTET_STRING_t));// need to check
+  OCTET_STRING_fromBuf(&mbms_Session_2->tmgi_r9.serviceId_r9,(const char*)&TMGI[3],3);
+  // Session ID is still missing here
+  mbms_Session_2->sessionID_r9->buf= MALLOC(1);
+  mbms_Session_2->sessionID_r9->size= 1;
+  mbms_Session_2->sessionID_r9->buf[0]= 0x11;
+  // Logical Channel ID
+  mbms_Session_2->logicalChannelIdentity_r9= 2;
+  ASN_SEQUENCE_ADD(&pmch_Info_1->mbms_SessionInfoList_r9.list,mbms_Session_2);
+  */
+  ASN_SEQUENCE_ADD(&(*mbsfnAreaConfiguration)->pmch_InfoList_r9.list,pmch_Info_1);
+
+#ifdef XER_PRINT
+  xer_fprint(stdout,&asn_DEF_MCCH_Message,(void*)mcch_message);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_MCCH_Message,
+                                   (void*)mcch_message,
+                                   buffer,
+                                   100);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_MCCH_Message, (void *) &mcch_message)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_MCCH, message_string_size);
+      msg_p->ittiMsg.rrc_dl_mcch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_mcch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  LOG_D(RRC,"[eNB] MCCH Message Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+#endif
+
+  if (enc_rval.encoded==-1) {
+    msg("[RRC] ASN1 : MCCH  encoding failed for MBSFNAreaConfiguration\n");
+    return(-1);
+  }
+
+  return((enc_rval.encoded+7)/8);
+}
+#endif
+
+uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t)
+{
+
+  asn_enc_rval_t enc_rval;
+
+  UL_DCCH_Message_t ul_dcch_msg;
+
+  MeasurementReport_t  *measurementReport;
+
+  ul_dcch_msg.message.present                     = UL_DCCH_MessageType_PR_c1;
+  ul_dcch_msg.message.choice.c1.present           = UL_DCCH_MessageType__c1_PR_measurementReport;
+  measurementReport            = &ul_dcch_msg.message.choice.c1.choice.measurementReport;
+
+  measurementReport->criticalExtensions.present=MeasurementReport__criticalExtensions_PR_c1;
+  measurementReport->criticalExtensions.choice.c1.present=MeasurementReport__criticalExtensions__c1_PR_measurementReport_r8;
+  measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension=CALLOC(1,
+      sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension));
+
+  measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measId=measid;
+#if defined(Rel10) || defined(Rel14)
+  measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrpResult=rsrp_s;
+  measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrqResult=rsrq_s;
+#else
+  measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultServCell.rsrpResult=rsrp_s;
+  measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultServCell.rsrqResult=rsrq_s;
+#endif
+  measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells=CALLOC(1,
+      sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells));
+  measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->present=MeasResults__measResultNeighCells_PR_measResultListEUTRA;
+
+  MeasResultListEUTRA_t  *measResultListEUTRA2;
+  measResultListEUTRA2 = CALLOC(1,sizeof(*measResultListEUTRA2));
+
+  struct MeasResultEUTRA *measresulteutra2;
+  measresulteutra2 = CALLOC(1,sizeof(*measresulteutra2));
+  measresulteutra2->physCellId=phy_id;//1;
+
+  struct MeasResultEUTRA__cgi_Info *measresult_cgi2;
+  measresult_cgi2 = CALLOC(1,sizeof(*measresult_cgi2));
+
+  memset(&measresult_cgi2->cellGlobalId.plmn_Identity,0,sizeof(measresult_cgi2->cellGlobalId.plmn_Identity));
+
+  // measresult_cgi2->cellGlobalId.plmn_Identity.mcc=CALLOC(1,sizeof(measresult_cgi2->cellGlobalId.plmn_Identity.mcc));
+  measresult_cgi2->cellGlobalId.plmn_Identity.mcc = CALLOC(1, sizeof(*measresult_cgi2->cellGlobalId.plmn_Identity.mcc));
+
+  asn_set_empty(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list);//.size=0;
+
+  MCC_MNC_Digit_t dummy;
+  dummy=2;
+  ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list,&dummy);
+  dummy=6;
+  ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list,&dummy);
+  dummy=2;
+  ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list,&dummy);
+
+  measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list.size=0;
+  measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list.count=0;
+  dummy=8;
+  ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list,&dummy);
+  dummy=0;
+  ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list,&dummy);
+
+  measresult_cgi2->cellGlobalId.cellIdentity.buf=MALLOC(8);
+  measresult_cgi2->cellGlobalId.cellIdentity.buf[0]=0x01;
+  measresult_cgi2->cellGlobalId.cellIdentity.buf[1]=0x48;
+  measresult_cgi2->cellGlobalId.cellIdentity.buf[2]=0x0f;
+  measresult_cgi2->cellGlobalId.cellIdentity.buf[3]=0x03;
+  measresult_cgi2->cellGlobalId.cellIdentity.size=4;
+  measresult_cgi2->cellGlobalId.cellIdentity.bits_unused=4;
+
+  measresult_cgi2->trackingAreaCode.buf = MALLOC(2);
+  measresult_cgi2->trackingAreaCode.buf[0]=0x00;
+  measresult_cgi2->trackingAreaCode.buf[1]=0x10;
+  measresult_cgi2->trackingAreaCode.size=2;
+  measresult_cgi2->trackingAreaCode.bits_unused=0;
+
+
+  measresulteutra2->cgi_Info=measresult_cgi2;
+
+  struct MeasResultEUTRA__measResult meas2;
+  //    int rsrp_va=10;
+
+  meas2.rsrpResult=&(rsrp_t);
+  //&rsrp_va;
+  meas2.rsrqResult=&(rsrq_t);
+
+  measresulteutra2->measResult=meas2;
+
+  ASN_SEQUENCE_ADD(&measResultListEUTRA2->list,measresulteutra2);
+
+  measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA=*(measResultListEUTRA2);
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
+                                   (void*)&ul_dcch_msg,
+                                   buffer,
+                                   100);
+
+
+
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[20000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p);
+    }
+  }
+# endif
+#endif
+
+#ifdef USER_MODE
+  printf("Measurement Report Encoded %zu bits (%zu bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
+#endif
+
+  return((enc_rval.encoded+7)/8);
+}
+
+uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t transaction_id, uint32_t pdu_length, uint8_t *pdu_buffer)
+{
+  ssize_t encoded;
+
+  DL_DCCH_Message_t dl_dcch_msg;
+
+  memset(&dl_dcch_msg, 0, sizeof(DL_DCCH_Message_t));
+
+  dl_dcch_msg.message.present           = DL_DCCH_MessageType_PR_c1;
+  dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_dlInformationTransfer;
+  dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.rrc_TransactionIdentifier = transaction_id;
+  dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.present = DLInformationTransfer__criticalExtensions_PR_c1;
+  dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.present = DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8;
+  dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.present =
+    DLInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS;
+  dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.size = pdu_length;
+  dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.buf = pdu_buffer;
+
+  encoded = uper_encode_to_new_buffer (&asn_DEF_DL_DCCH_Message, NULL, (void*) &dl_dcch_msg, (void **) buffer);
+
+  /*
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+  {
+    char        message_string[10000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *)&dl_dcch_msg)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
+    }
+  }
+# endif
+#endif
+  */
+
+  return encoded;
+}
+
+uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer)
+{
+  ssize_t encoded;
+
+  UL_DCCH_Message_t ul_dcch_msg;
+
+  memset(&ul_dcch_msg, 0, sizeof(UL_DCCH_Message_t));
+
+  ul_dcch_msg.message.present           = UL_DCCH_MessageType_PR_c1;
+  ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_ulInformationTransfer;
+  ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.present = ULInformationTransfer__criticalExtensions_PR_c1;
+  ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.present = DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8;
+  ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.present =
+    ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS;
+  ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.size = pdu_length;
+  ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.buf = pdu_buffer;
+
+  encoded = uper_encode_to_new_buffer (&asn_DEF_UL_DCCH_Message, NULL, (void*) &ul_dcch_msg, (void **) buffer);
+
+  return encoded;
+}
+
+OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname)
+{
+  static OAI_UECapability_t UECapability; /* TODO declared static to allow returning this has an address should be allocated in a cleaner way. */
+  static SupportedBandEUTRA_t Bandlist[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it
+  static InterFreqBandInfo_t InterFreqBandInfo[4][4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it
+  static BandInfoEUTRA_t BandInfoEUTRA[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it
+
+  asn_enc_rval_t enc_rval;
+  asn_dec_rval_t dec_rval;
+
+  long maxNumberROHC_ContextSessions = PDCP_Parameters__maxNumberROHC_ContextSessions_cs16;
+  int i;
+
+  UE_EUTRA_Capability_t *UE_EUTRA_Capability;
+  char UE_EUTRA_Capability_xer[8192];
+  size_t size;
+
+  LOG_I(RRC,"Allocating %zu bytes for UE_EUTRA_Capability\n",sizeof(*UE_EUTRA_Capability));
+
+  UE_EUTRA_Capability = CALLOC(1, sizeof(*UE_EUTRA_Capability));
+
+  assert(UE_EUTRA_Capability);
+
+  if (!UE_EUTRA_Capability_xer_fname)  {
+    Bandlist[0].bandEUTRA  = 3;  // UL 1710-1785, DL 1805-1880 FDD
+    Bandlist[0].halfDuplex = 0;
+    Bandlist[1].bandEUTRA  = 20;  // UL 824-849 , DL 869-894 FDD
+    Bandlist[1].halfDuplex = 0;
+    Bandlist[2].bandEUTRA  = 7;   // UL 2500-2570, DL 2620-2690 FDD
+    Bandlist[2].halfDuplex = 0;
+    Bandlist[3].bandEUTRA  = 38;  // UL/DL 2570-2620, TDD
+    Bandlist[3].halfDuplex = 0;
+
+    memset((void*)InterFreqBandInfo, 0, sizeof(InterFreqBandInfo));
+    memset((void*)BandInfoEUTRA, 0, sizeof(BandInfoEUTRA));
+
+    InterFreqBandInfo[0][0].interFreqNeedForGaps = 0;
+    InterFreqBandInfo[0][1].interFreqNeedForGaps = 1;
+    InterFreqBandInfo[0][2].interFreqNeedForGaps = 1;
+    InterFreqBandInfo[0][3].interFreqNeedForGaps = 1;
+    InterFreqBandInfo[1][0].interFreqNeedForGaps = 1;
+    InterFreqBandInfo[1][1].interFreqNeedForGaps = 0;
+    InterFreqBandInfo[1][2].interFreqNeedForGaps = 1;
+    InterFreqBandInfo[1][3].interFreqNeedForGaps = 1;
+    InterFreqBandInfo[2][0].interFreqNeedForGaps = 1;
+    InterFreqBandInfo[2][1].interFreqNeedForGaps = 1;
+    InterFreqBandInfo[2][2].interFreqNeedForGaps = 0;
+    InterFreqBandInfo[2][3].interFreqNeedForGaps = 1;
+    InterFreqBandInfo[3][0].interFreqNeedForGaps = 1;
+    InterFreqBandInfo[3][1].interFreqNeedForGaps = 1;
+    InterFreqBandInfo[3][2].interFreqNeedForGaps = 1;
+    InterFreqBandInfo[3][3].interFreqNeedForGaps = 0;
+
+
+    UE_EUTRA_Capability->accessStratumRelease = 0;//AccessStratumRelease_rel8;
+    UE_EUTRA_Capability->ue_Category          = 4;
+    UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0001=0;
+    UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0002=0;
+    UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0003=0;
+    UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0004=0;
+    UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0006=0;
+    UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0101=0;
+    UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0102=0;
+    UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0103=0;
+    UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0104=0;
+
+    UE_EUTRA_Capability->pdcp_Parameters.maxNumberROHC_ContextSessions = &maxNumberROHC_ContextSessions;
+
+    UE_EUTRA_Capability->phyLayerParameters.ue_TxAntennaSelectionSupported = 0;
+    UE_EUTRA_Capability->phyLayerParameters.ue_SpecificRefSigsSupported    = 0;
+    UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count                          = 0;
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[0]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[1]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[2]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[3]);
+
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[0]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[1]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[2]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[3]);
+
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][0]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][1]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][2]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][3]);
+
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][0]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][1]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][2]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][3]);
+
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][0]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][1]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][2]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][3]);
+
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][0]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][1]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][2]);
+    ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][3]);
+
+    // UE_EUTRA_Capability->measParameters.bandListEUTRA.list.count                         = 0;  // no measurements on other bands
+    // UE_EUTRA_Capability->featureGroupIndicators  // null
+
+    if(usim_test == 1)
+    {
+      // featureGroup is mandatory for CMW tests
+      // featureGroup is filled only for usim-test mode
+      BIT_STRING_t *bit_string = CALLOC(1, sizeof(*bit_string));
+      char featrG[4]           = { 0x00, 0x08, 0x00, 0x04 };
+      bit_string->buf          = CALLOC(1, 4);
+      memcpy(bit_string->buf, featrG, 4);
+      bit_string->size         = 4;
+      bit_string->bits_unused  = 0;
+      UE_EUTRA_Capability->featureGroupIndicators = bit_string;
+    }
+
+    // UE_EUTRA_Capability->interRAT_Parameters     // null
+  } else {
+
+    FILE* f = fopen(UE_EUTRA_Capability_xer_fname, "r");
+    assert(f);
+    size = fread(UE_EUTRA_Capability_xer, 1, sizeof UE_EUTRA_Capability_xer, f);
+    fclose(f);
+
+    if (size == 0 || size == sizeof UE_EUTRA_Capability_xer) {
+      LOG_E(RRC,"UE Capabilities XER file %s is too large\n", UE_EUTRA_Capability_xer_fname);
+      free( UE_EUTRA_Capability);
+      return(NULL);
+    }
+
+    dec_rval = xer_decode(0, &asn_DEF_UE_EUTRA_Capability, (void*)UE_EUTRA_Capability, UE_EUTRA_Capability_xer, size);
+    assert(dec_rval.code == RC_OK);
+  }
+
+  UECapability.UE_EUTRA_Capability = UE_EUTRA_Capability;
+#ifdef XER_PRINT
+  xer_fprint(stdout,&asn_DEF_UE_EUTRA_Capability,(void *)UE_EUTRA_Capability);
+#endif
+  enc_rval = uper_encode_to_buffer(&asn_DEF_UE_EUTRA_Capability,
+                                   (void*)UE_EUTRA_Capability,
+                                   &UECapability.sdu[0],
+                                   MAX_UE_CAPABILITY_SIZE);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if defined(DISABLE_XER_SPRINT)
+  {
+    MessageDef *msg_p;
+
+    msg_p = itti_alloc_new_message (TASK_RRC_UE, RRC_UE_EUTRA_CAPABILITY);
+    memcpy (&msg_p->ittiMsg, (void *) UE_EUTRA_Capability, sizeof(RrcUeEutraCapability));
+
+    itti_send_msg_to_task (TASK_UNKNOWN, NB_eNB_INST, msg_p);
+  }
+# else
+  {
+    char        message_string[10000];
+    size_t      message_string_size;
+
+    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability)) > 0) {
+      MessageDef *msg_p;
+
+      msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UE_EUTRA_CAPABILITY, message_string_size + sizeof (IttiMsgText));
+      msg_p->ittiMsg.rrc_ue_eutra_capability.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_ue_eutra_capability.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, msg_p);
+    }
+  }
+# endif
+#endif
+
+  UECapability.sdu_size = (enc_rval.encoded + 7) / 8;
+  LOG_I(PHY, "[RRC]UE Capability encoded, %d bytes (%zd bits)\n",
+        UECapability.sdu_size, enc_rval.encoded + 7);
+  {
+    char *sdu;
+    sdu = malloc (3 * UECapability.sdu_size + 1 /* For '\0' */);
+
+    for (i = 0; i < UECapability.sdu_size; i++) {
+      sprintf (&sdu[3 * i], "%02x.", UECapability.sdu[i]);
+    }
+
+    LOG_D(PHY, "[RRC]UE Capability encoded, %s\n", sdu);
+    free(sdu);
+  }
+
+  return(&UECapability);
+}
+
diff --git a/openair2/RRC/NR/defs_NR.h b/openair2/RRC/NR/defs_NR.h
new file mode 100644
index 0000000000000000000000000000000000000000..88d2510fb6d20012dd6cd6c7fe0d873908321ea9
--- /dev/null
+++ b/openair2/RRC/NR/defs_NR.h
@@ -0,0 +1,616 @@
+/* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file RRC/LITE/defs_NR.h
+* \brief NR RRC struct definitions and function prototypes
+* \author Navid Nikaein, Raymond Knopp and WEI-TAI CHEN
+* \date 2010 - 2014, 2018
+* \version 1.0
+* \company Eurecom
+* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr, kroempa@gmail.com.tw
+*/
+
+#ifndef __OPENAIR_RRC_DEFS_NR_H__
+#define __OPENAIR_RRC_DEFS_NR_H__
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "collection/tree.h"
+#include "rrc_types_NR.h"
+#include "COMMON/platform_constants.h"
+#include "COMMON/platform_types.h"
+
+//#include "COMMON/mac_rrc_primitives.h"
+#if defined(Rel15)
+#include "SIB1.h"
+//#include "SystemInformation.h"
+//#include "RRCConnectionReconfiguration.h"
+//#include "RRCConnectionReconfigurationComplete.h"
+//#include "RRCConnectionSetup.h"
+//#include "RRCConnectionSetupComplete.h"
+//#include "RRCConnectionRequest.h"
+//#include "RRCConnectionReestablishmentRequest.h"
+//#include "BCCH-DL-SCH-Message.h"
+#include "BCCH-BCH-Message.h"
+//#include "MCCH-Message.h"
+//#include "MBSFNAreaConfiguration-r9.h"
+//#include "SCellToAddMod-r10.h"
+//#include "AS-Config.h"
+//#include "AS-Context.h"
+#include "UE-NR-Capability.h"
+#include "MeasResults.h"
+#endif
+//-------------------
+
+#if defined(ENABLE_ITTI)
+# include "intertask_interface.h"
+#endif
+
+/* TODO: be sure this include is correct.
+ * It solves a problem of compilation of the RRH GW,
+ * issue #186.
+ */
+#if !defined(ENABLE_ITTI)
+# include "as_message.h"
+#endif
+
+#if defined(ENABLE_USE_MME)
+# include "commonDef.h"
+#endif
+
+#if ENABLE_RAL
+# include "collection/hashtable/obj_hashtable.h"
+#endif
+
+
+
+/*I will change the name of the structure for compile purposes--> hope not to undo this process*/
+
+typedef unsigned int uid_NR_t;
+#define UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NR (((NUMBER_OF_UE_MAX_NR/8)/sizeof(unsigned int)) + 1)
+
+typedef struct uid_linear_allocator_NR_s {
+  unsigned int   bitmap[UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NR];
+} uid_allocator_NR_t;
+
+
+#define PROTOCOL_RRC_CTXT_UE_FMT                PROTOCOL_CTXT_FMT
+#define PROTOCOL_RRC_CTXT_UE_ARGS(CTXT_Pp)      PROTOCOL_CTXT_ARGS(CTXT_Pp)
+
+#define PROTOCOL_RRC_CTXT_FMT                   PROTOCOL_CTXT_FMT
+#define PROTOCOL_RRC_CTXT_ARGS(CTXT_Pp)         PROTOCOL_CTXT_ARGS(CTXT_Pp)
+
+
+#define UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!!
+#define UE_INDEX_INVALID  ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! used to be -1
+
+typedef enum {
+  RRC_OK=0,
+  RRC_ConnSetup_failed,
+  RRC_PHY_RESYNCH,
+  RRC_Handover_failed,
+  RRC_HO_STARTED
+} RRC_status_NR_t;
+
+typedef enum UE_STATE_NR_e {
+  RRC_INACTIVE=0,
+  RRC_IDLE,
+  RRC_SI_RECEIVED,
+  RRC_CONNECTED,
+  RRC_RECONFIGURED,
+  RRC_HO_EXECUTION
+} UE_STATE_NR_t;
+
+typedef enum HO_STATE_NR_e {
+  HO_IDLE=0,
+  HO_MEASURMENT,
+  HO_PREPARE,
+  HO_CMD, // initiated by the src eNB
+  HO_COMPLETE // initiated by the target eNB
+} HO_STATE_NR_t;
+
+//#define NUMBER_OF_UE_MAX MAX_MOBILES_PER_RG
+#define RRM_FREE(p)       if ( (p) != NULL) { free(p) ; p=NULL ; }
+#define RRM_MALLOC(t,n)   (t *) malloc16( sizeof(t) * n )
+#define RRM_CALLOC(t,n)   (t *) malloc16( sizeof(t) * n)
+#define RRM_CALLOC2(t,s)  (t *) malloc16( s )
+
+#define MAX_MEAS_OBJ                                  6
+#define MAX_MEAS_CONFIG                               6
+#define MAX_MEAS_ID                                   6
+
+#define PAYLOAD_SIZE_MAX                              1024
+#define RRC_BUF_SIZE                                  255
+#define UNDEF_SECURITY_MODE                           0xff
+#define NO_SECURITY_MODE                              0x20
+
+/* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */
+#define RRC_TRANSACTION_IDENTIFIER_NUMBER             3
+
+typedef struct {
+  unsigned short                                      transport_block_size;      /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */
+  unsigned short                                      max_transport_blocks;      /*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */
+  unsigned long                                       Guaranteed_bit_rate;       /*!< \brief Guaranteed Bit Rate (average) to be offered by MAC layer scheduling*/
+  unsigned long                                       Max_bit_rate;              /*!< \brief Maximum Bit Rate that can be offered by MAC layer scheduling*/
+  uint8_t                                             Delay_class;               /*!< \brief Delay class offered by MAC layer scheduling*/
+  uint8_t                                             Target_bler;               /*!< \brief Target Average Transport Block Error rate*/
+  uint8_t                                             Lchan_t;                   /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/
+} __attribute__ ((__packed__))  LCHAN_DESC_NR;
+
+typedef struct UE_RRC_INFO_NR_s {
+  UE_STATE_NR_t                                       State;
+  uint8_t                                             SIB1systemInfoValueTag;
+  uint32_t                                            SIStatus;
+  uint32_t                                            SIcnt;
+#if defined(Rel10) || defined(Rel14)
+  uint8_t                                             MCCHStatus[8];             // MAX_MBSFN_AREA
+#endif
+  uint8_t                                             SIwindowsize;              //!< Corresponds to the SIB1 si-WindowLength parameter. The unit is ms. Possible values are (final): 1,2,5,10,15,20,40
+  uint8_t                                             handoverTarget;
+  //HO_STATE_t ho_state;
+  uint16_t                                            SIperiod;                  //!< Corresponds to the SIB1 si-Periodicity parameter (multiplied by 10). Possible values are (final): 80,160,320,640,1280,2560,5120
+  unsigned short                                      UE_index;
+  uint32_t                                            T300_active;
+  uint32_t                                            T300_cnt;
+  uint32_t                                            T304_active;
+  uint32_t                                            T304_cnt;
+  uint32_t                                            T310_active;
+  uint32_t                                            T310_cnt;
+  uint32_t                                            N310_cnt;
+  uint32_t                                            N311_cnt;
+  rnti_t                                              rnti;
+} __attribute__ ((__packed__)) UE_RRC_INFO_NR;
+
+typedef struct UE_S_TMSI_NR_s {
+  boolean_t                                           presence;
+  mme_code_t                                          mme_code;
+  m_tmsi_t                                            m_tmsi;
+} __attribute__ ((__packed__)) UE_S_TMSI_NR;
+
+
+typedef enum e_rab_satus_NR_e {
+  E_RAB_STATUS_NEW_NR,
+  E_RAB_STATUS_DONE_NR,           // from the eNB perspective
+  E_RAB_STATUS_ESTABLISHED_NR,    // get the reconfigurationcomplete form UE
+  E_RAB_STATUS_FAILED_NR,
+} e_rab_status_NR_t;
+
+typedef struct e_rab_param_NR_s {
+  e_rab_t param;
+  uint8_t status;
+  uint8_t xid; // transaction_id
+} __attribute__ ((__packed__)) e_rab_param_NR_t;
+
+
+typedef struct HANDOVER_INFO_NR_s {
+  uint8_t                                             ho_prepare;
+  uint8_t                                             ho_complete;
+  uint8_t                                             modid_s;            //module_idP of serving cell
+  uint8_t                                             modid_t;            //module_idP of target cell
+  uint8_t                                             ueid_s;             //UE index in serving cell
+  uint8_t                                             ueid_t;             //UE index in target cell
+
+  // NR not define at this moment
+  //AS_Config_t                                       as_config;          /* these two parameters are taken from 36.331 section 10.2.2: HandoverPreparationInformation-r8-IEs */
+  //AS_Context_t                                      as_context;         /* They are mandatory for HO */
+
+  uint8_t                                             buf[RRC_BUF_SIZE];  /* ASN.1 encoded handoverCommandMessage */
+  int                                                 size;               /* size of above message in bytes */
+} HANDOVER_INFO_NR;
+
+
+#define RRC_HEADER_SIZE_MAX 64
+#define RRC_BUFFER_SIZE_MAX 1024
+
+typedef struct {
+  char                                                Payload[RRC_BUFFER_SIZE_MAX];
+  char                                                Header[RRC_HEADER_SIZE_MAX];
+  char                                                payload_size;
+} RRC_BUFFER_NR;
+
+#define RRC_BUFFER_SIZE_NR                            sizeof(RRC_BUFFER_NR)
+
+
+typedef struct RB_INFO_NR_s {
+  uint16_t                                            Rb_id;  //=Lchan_id
+  LCHAN_DESC Lchan_desc[2]; 
+  //MAC_MEAS_REQ_ENTRY *Meas_entry; //may not needed for NB-IoT
+} RB_INFO_NR;
+
+typedef struct SRB_INFO_NR_s {
+  uint16_t                                            Srb_id;         //=Lchan_id
+  RRC_BUFFER                                          Rx_buffer;
+  RRC_BUFFER                                          Tx_buffer;
+  LCHAN_DESC                                          Lchan_desc[2];
+  unsigned int                                        Trans_id;
+  uint8_t                                             Active;
+} SRB_INFO_NR;
+
+
+typedef struct RB_INFO_TABLE_ENTRY_NR_s {
+  RB_INFO_NR                                          Rb_info;
+  uint8_t                                             Active;
+  uint32_t                                            Next_check_frame;
+  uint8_t                                             Status;
+} RB_INFO_TABLE_ENTRY_NR;
+
+typedef struct SRB_INFO_TABLE_ENTRY_NR_s {
+  SRB_INFO_NR                                         Srb_info;
+  uint8_t                                             Active;
+  uint8_t                                             Status;
+  uint32_t                                            Next_check_frame;
+} SRB_INFO_TABLE_ENTRY_NR;
+
+typedef struct MEAS_REPORT_LIST_NR_s {
+  MeasId_t                                            measId;
+  //CellsTriggeredList  cellsTriggeredList;//OPTIONAL
+  uint32_t                                            numberOfReportsSent;
+} MEAS_REPORT_LIST_NR;
+
+typedef struct HANDOVER_INFO_UE_NR_s {
+  PhysCellId_t                                        targetCellId;
+  uint8_t                                             measFlag;
+} HANDOVER_INFO_UE_NR;
+
+//NB-IoT eNB_RRC_UE_NB_IoT_s--(used as a context in eNB --> ue_context in rrc_eNB_ue_context)------
+typedef struct gNB_RRC_UE_s {
+
+  uint8_t                                             primaryCC_id;
+  
+  //SCellToAddMod_t                               sCell_config[2];
+
+  SRB_ToAddModList_t*                                 SRB_configList;//for SRB1 and SRB1bis
+  SRB_ToAddModList_t*                                 SRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
+  DRB_ToAddModList_t*                                 DRB_configList; //for all the DRBs
+  DRB_ToAddModList_t*                                 DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; //for the configured DRBs of a xid
+  uint8_t                                             DRB_active[8];//in LTE was 8 
+
+  // NR not define at this moment
+  //struct PhysicalConfigDedicated*                   physicalConfigDedicated_NR;
+  
+  struct SPS_Config*                                  sps_Config;
+  MeasObjectToAddMod_t*                               MeasObj[MAX_MEAS_OBJ];
+  struct ReportConfigToAddMod*                        ReportConfig[MAX_MEAS_CONFIG];
+  struct QuantityConfig*                              QuantityConfig;
+  struct MeasIdToAddMod*                              MeasId[MAX_MEAS_ID];
+
+  // NR not define at this moment
+  //MAC_MainConfig_t*                                 mac_MainConfig_NR;
+
+  MeasGapConfig_t*                                    measGapConfig;
+
+  SRB_INFO_NR                                         SI;
+  SRB_INFO_NR                                         Srb0;
+  SRB_INFO_TABLE_ENTRY_NR                             Srb1;
+  SRB_INFO_TABLE_ENTRY_NR                             Srb2;
+
+  MeasConfig_t*                                       measConfig;
+  HANDOVER_INFO_NR*                                   handover_info;
+
+
+#if defined(ENABLE_SECURITY)
+  /* KeNB as derived from KASME received from EPC */
+  uint8_t                                             kenb[32];
+#endif
+
+  /* Used integrity/ciphering algorithms */
+  //Specs. TS 38.331 V15.1.0 pag 432 Change position of chipering enumerative w.r.t previous version
+  e_CipheringAlgorithm                                ciphering_algorithm; 
+  e_IntegrityProtAlgorithm                            integrity_algorithm;
+
+  uint8_t                                             Status;
+  rnti_t                                              rnti;
+  uint64_t                                            random_ue_identity;
+
+
+
+  /* Information from UE RRC ConnectionRequest */
+  UE_S_TMSI_NR                                        Initialue_identity_s_TMSI;
+  
+  /* NR not define at this moment
+  EstablishmentCause_t                             establishment_cause_NR; //different set for NB-IoT
+  
+  /* NR not define at this moment
+  /* Information from UE RRC ConnectionReestablishmentRequest  */
+  //ReestablishmentCause_t                           reestablishment_cause_NR; //different set for NB_IoT
+
+  /* UE id for initial connection to S1AP */
+  uint16_t                                            ue_initial_id;
+
+  /* Information from S1AP initial_context_setup_req */
+  uint32_t                                            eNB_ue_s1ap_id :24;
+
+  security_capabilities_t                             security_capabilities;
+
+  /* Total number of e_rab already setup in the list */ //NAS list?
+  uint8_t                                             setup_e_rabs;
+  /* Number of e_rab to be setup in the list */ //NAS list?
+  uint8_t                                             nb_of_e_rabs;
+  /* list of e_rab to be setup by RRC layers */
+  e_rab_param_NR_t                                    e_rab[NB_RB_MAX_NB_IOT];//[S1AP_MAX_E_RAB];
+
+  // LG: For GTPV1 TUNNELS
+  uint32_t                                            enb_gtp_teid[S1AP_MAX_E_RAB];
+  transport_layer_addr_t                              enb_gtp_addrs[S1AP_MAX_E_RAB];
+  rb_id_t                                             enb_gtp_ebi[S1AP_MAX_E_RAB];
+
+ //Which timers are referring to?
+  uint32_t                                            ul_failure_timer;
+  uint32_t                                            ue_release_timer;
+  //threshold of the release timer--> set in RRCConnectionRelease
+  uint32_t                                            ue_release_timer_thres;
+} gNB_RRC_UE_t;
+//--------------------------------------------------------------------------------
+
+typedef uid_NR_t ue_uid_t;
+
+
+//generally variable called: ue_context_pP
+typedef struct rrc_gNB_ue_context_s {
+
+  /* Tree related data */
+  RB_ENTRY(rrc_gNB_ue_context_s)         entries;
+
+  /* Uniquely identifies the UE between MME and eNB within the eNB.
+   * This id is encoded on 24bits.
+   */
+  rnti_t                                    ue_id_rnti;
+
+  // another key for protocol layers but should not be used as a key for RB tree
+  ue_uid_t                                  local_uid;
+
+  /* UE id for initial connection to S1AP */
+  struct gNB_RRC_UE_s                       ue_context; //context of ue in the e-nB
+
+} rrc_gNB_ue_context_t;
+
+
+//called "carrier"--> data from PHY layer
+typedef struct {
+
+  // buffer that contains the encoded messages
+  uint8_t							                      *MIB_NR;
+  uint8_t							                      sizeof_MIB_NR;
+/*
+  uint8_t                                   *SIB1_NB_IoT;
+  uint8_t                                   sizeof_SIB1_NB_IoT;
+  uint8_t                         	        *SIB23_NB_IoT;
+  uint8_t                        	          sizeof_SIB23_NB_IoT;
+*/
+
+/*
+  //not actually implemented in OAI
+  uint8_t                                   *SIB4_NB_IoT;
+  uint8_t                                   sizeof_SIB4_NB_IoT;
+  uint8_t                                   *SIB5_NB_IoT;
+  uint8_t                                   sizeof_SIB5_NB_IoT;
+  uint8_t                                   *SIB14_NB_IoT;
+  uint8_t                                   sizeof_SIB14_NB_IoT;
+  uint8_t                                   *SIB16_NB_IoT;
+  uint8_t                                   sizeof_SIB16_NB_IoT;
+*/
+  //TS 36.331 V14.2.1
+//  uint8_t                                 *SIB15_NB;
+//  uint8_t                                 sizeof_SIB15_NB;
+//  uint8_t                                 *SIB20_NB;
+//  uint8_t                                 sizeof_SIB20_NB;
+//  uint8_t                                 *SIB22_NB;
+//  uint8_t                                 sizeof_SIB22_NB;
+
+  //implicit parameters needed
+  int                                       Ncp; //cyclic prefix for DL
+  int								                        Ncp_UL; //cyclic prefix for UL
+  int                                       p_eNB; //number of tx antenna port
+  int								                        p_rx_eNB; //number of receiving antenna ports
+  uint32_t                                  dl_CarrierFreq; //detected by the UE
+  uint32_t                                  ul_CarrierFreq; //detected by the UE
+  uint16_t                                  physCellId; //not stored in the MIB-NB but is getting through NPSS/NSSS
+
+  //are the only static one (memory has been already allocated)
+  BCCH_BCH_Message_t                        mib_NR;
+  
+  /*
+  BCCH_DL_SCH_Message_NR_t                  siblock1_NB_IoT; //SIB1-NB
+  BCCH_DL_SCH_Message_NR_t                  systemInformation_NB_IoT; //SI
+  */
+  SIB1_t     		                            *sib1_NR;
+  /*
+  SIB2_t   	                                *sib2_NR;
+  SIB3_t   	                                *sib3_NR;
+  //not implemented yet
+  SIB4_t    	                              *sib4_NR;
+  SIB5_t     	                              *sib5_NR;
+  */
+
+
+  SRB_INFO_NR                               SI;
+  SRB_INFO_NR                               Srb0;
+
+  uint8_t                                   **MCCH_MESSAGE; //  probably not needed , but added to remove errors
+  uint8_t                                   sizeof_MCCH_MESSAGE[8];// but added to remove errors
+  SRB_INFO_NR                               MCCH_MESS[8];// MAX_MBSFN_AREA
+
+  /*future implementation TS 36.331 V14.2.1
+  SystemInformationBlockType15_NB_r14_t     *sib15;
+  SystemInformationBlockType20_NB_r14_t     *sib20;
+  SystemInformationBlockType22_NB_r14_t     *sib22;
+
+  uint8_t							                      SCPTM_flag;
+  uint8_t							                      sizeof_SC_MCHH_MESS[];
+  SC_MCCH_Message_NR_t				              scptm;*/
+
+
+} rrc_gNB_carrier_data_t;
+//---------------------------------------------------
+
+
+
+//---NR---(completely change)---------------------
+typedef struct gNB_RRC_INST_s {
+
+  eth_params_t                                        eth_params_s;
+  rrc_gNB_carrier_data_t                              carrier[MAX_NUM_CCs];
+  uid_allocator_NR_t                                  uid_allocator; // for rrc_ue_head
+  RB_HEAD(rrc_ue_tree_NR_s, rrc_gNB_ue_context_s)     rrc_ue_head; // ue_context tree key search by rnti
+  
+  uint8_t                                             HO_flag;
+  uint8_t                                             Nb_ue;
+
+  hash_table_t                                        *initial_id2_s1ap_ids; // key is    content is rrc_ue_s1ap_ids_t
+  hash_table_t                                        *s1ap_id2_s1ap_ids   ; // key is    content is rrc_ue_s1ap_ids_t
+
+  //RRC configuration
+#if defined(ENABLE_ITTI)
+  gNB_RrcConfigurationReq                             configuration;//rrc_messages_types.h
+#endif
+  // other PLMN parameters
+  /// Mobile country code
+  int mcc;
+  /// Mobile network code
+  int mnc;
+  /// number of mnc digits
+  int mnc_digit_length;
+
+  // other RAN parameters
+  int srb1_timer_poll_retransmit;
+  int srb1_poll_pdu;
+  int srb1_poll_byte;
+  int srb1_max_retx_threshold;
+  int srb1_timer_reordering;
+  int srb1_timer_status_prohibit;
+  int srs_enable[MAX_NUM_CCs];
+
+} gNB_RRC_INST;
+
+//#define RRC_HEADER_SIZE_MAX_NR 64
+#define MAX_UE_CAPABILITY_SIZE_NR 255
+
+//not needed for the moment
+typedef struct OAI_UECapability_NR_s {
+ uint8_t sdu[MAX_UE_CAPABILITY_SIZE_NR];
+ uint8_t sdu_size;
+////NR------
+  UE_NR_Capability_t  UE_Capability_NR; //replace the UE_EUTRA_Capability of LTE
+} OAI_UECapability_NR_t;
+
+
+typedef struct UE_RRC_INST_NR_s {
+  Rrc_State_NR_t     RrcState;
+  Rrc_Sub_State_NR_t RrcSubState;
+# if defined(ENABLE_USE_MME)
+  plmn_t          plmnID;
+  Byte_t          rat;
+  as_nas_info_t   initialNasMsg;
+# endif
+  OAI_UECapability_NR_t *UECap;
+  uint8_t *UECapability;
+  uint8_t UECapability_size;
+
+  UE_RRC_INFO_NR              Info[NB_SIG_CNX_UE];
+  
+  SRB_INFO_NR                 Srb0[NB_SIG_CNX_UE];
+  SRB_INFO_TABLE_ENTRY_NR     Srb1[NB_CNX_UE];
+  SRB_INFO_TABLE_ENTRY_NR     Srb2[NB_CNX_UE];
+  HANDOVER_INFO_UE_NR         HandoverInfoUe;
+  /*
+  uint8_t *SIB1[NB_CNX_UE];
+  uint8_t sizeof_SIB1[NB_CNX_UE];
+  uint8_t *SI[NB_CNX_UE];
+  uint8_t sizeof_SI[NB_CNX_UE];
+  uint8_t SIB1Status[NB_CNX_UE];
+  uint8_t SIStatus[NB_CNX_UE];
+  SIB1_t *sib1[NB_CNX_UE];
+  SystemInformation_t *si[NB_CNX_UE]; //!< Temporary storage for an SI message. Decoding happens in decode_SI().
+  
+  SystemInformationBlockType2_t *sib2[NB_CNX_UE];
+  /*
+  SystemInformationBlockType3_t *sib3[NB_CNX_UE];
+  SystemInformationBlockType4_t *sib4[NB_CNX_UE];
+  SystemInformationBlockType5_t *sib5[NB_CNX_UE];
+  SystemInformationBlockType6_t *sib6[NB_CNX_UE];
+  SystemInformationBlockType7_t *sib7[NB_CNX_UE];
+  SystemInformationBlockType8_t *sib8[NB_CNX_UE];
+  SystemInformationBlockType9_t *sib9[NB_CNX_UE];
+  SystemInformationBlockType10_t *sib10[NB_CNX_UE];
+  SystemInformationBlockType11_t *sib11[NB_CNX_UE];
+
+#if defined(Rel10) || defined(Rel14)
+  uint8_t                           MBMS_flag;
+  uint8_t *MCCH_MESSAGE[NB_CNX_UE];
+  uint8_t sizeof_MCCH_MESSAGE[NB_CNX_UE];
+  uint8_t MCCH_MESSAGEStatus[NB_CNX_UE];
+  MBSFNAreaConfiguration_r9_t       *mcch_message[NB_CNX_UE];
+  SystemInformationBlockType12_r9_t *sib12[NB_CNX_UE];
+  SystemInformationBlockType13_r9_t *sib13[NB_CNX_UE];
+#endif
+#ifdef CBA
+  uint8_t                         num_active_cba_groups;
+  uint16_t                        cba_rnti[NUM_MAX_CBA_GROUP];
+#endif
+  uint8_t                         num_srb;
+  struct SRB_ToAddMod             *SRB1_config[NB_CNX_UE];
+  struct SRB_ToAddMod             *SRB2_config[NB_CNX_UE];
+  struct DRB_ToAddMod             *DRB_config[NB_CNX_UE][8];
+  rb_id_t                         *defaultDRB; // remember the ID of the default DRB
+  MeasObjectToAddMod_t            *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ];
+  struct ReportConfigToAddMod     *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG];
+  */
+  struct QuantityConfig           *QuantityConfig[NB_CNX_UE];
+  /*
+  struct MeasIdToAddMod           *MeasId[NB_CNX_UE][MAX_MEAS_ID];
+  MEAS_REPORT_LIST      *measReportList[NB_CNX_UE][MAX_MEAS_ID];
+  uint32_t           measTimer[NB_CNX_UE][MAX_MEAS_ID][6]; // 6 neighboring cells
+  RSRP_Range_t                    s_measure;
+  struct MeasConfig__speedStatePars *speedStatePars;
+  struct PhysicalConfigDedicated  *physicalConfigDedicated[NB_CNX_UE];
+  struct SPS_Config               *sps_Config[NB_CNX_UE];
+  MAC_MainConfig_t                *mac_MainConfig[NB_CNX_UE];
+  MeasGapConfig_t                 *measGapConfig[NB_CNX_UE];
+  double                          filter_coeff_rsrp; // [7] ???
+  double                          filter_coeff_rsrq; // [7] ???
+  float                           rsrp_db[7];
+  float                           rsrq_db[7];
+  float                           rsrp_db_filtered[7];
+  float                           rsrq_db_filtered[7];
+#if ENABLE_RAL
+  obj_hash_table_t               *ral_meas_thresholds;
+  ral_transaction_id_t            scan_transaction_id;
+#endif
+#if defined(ENABLE_SECURITY)
+  // KeNB as computed from parameters within USIM card //
+  uint8_t kenb[32];
+#endif
+
+  // Used integrity/ciphering algorithms //
+  CipheringAlgorithm_r12_t                          ciphering_algorithm;
+  e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm;
+  */
+}UE_RRC_INST_NR;
+
+
+
+
+#include "proto_NR.h" //should be put here otherwise compilation error
+
+#endif
+/** @} */
diff --git a/openair2/RRC/NR/extern_NR.h b/openair2/RRC/NR/extern_NR.h
new file mode 100644
index 0000000000000000000000000000000000000000..b45dbd11e9557db9667b6c2ea24f1906eb67f774
--- /dev/null
+++ b/openair2/RRC/NR/extern_NR.h
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file vars.h
+* \brief rrc external vars
+* \author Navid Nikaein and Raymond Knopp
+* \date 2011
+* \version 1.0
+* \company Eurecom
+* \email: navid.nikaein@eurecom.fr
+*/
+
+#ifndef __OPENAIR_RRC_EXTERN_H__
+#define __OPENAIR_RRC_EXTERN_H__
+#include "defs.h"
+#include "COMMON/mac_rrc_primitives.h"
+#include "LAYER2/MAC/defs.h"
+#include "LAYER2/MAC/extern.h"
+#include "LAYER2/RLC/rlc.h"
+
+extern UE_RRC_INST *UE_rrc_inst;
+
+#include "LAYER2/MAC/extern.h"
+
+extern uint8_t DRB2LCHAN[8];
+
+extern LogicalChannelConfig_t SRB1_logicalChannelConfig_defaultValue;
+extern LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue;
+
+
+#ifndef PHY_EMUL
+#ifndef PHYSIM
+//#define NB_INST 1
+#else
+extern unsigned char NB_INST;
+#endif
+extern unsigned char NB_eNB_INST;
+extern unsigned char NB_UE_INST;
+extern unsigned short NODE_ID[1];
+extern void* bigphys_malloc(int);
+#endif
+
+
+//CONSTANTS
+extern rlc_info_t Rlc_info_um,Rlc_info_am_config;
+//uint8_t RACH_TIME_ALLOC;
+extern uint16_t RACH_FREQ_ALLOC;
+//uint8_t NB_RACH;
+extern LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
+extern MAC_MEAS_T BCCH_MEAS_TRIGGER,CCCH_MEAS_TRIGGER,DCCH_MEAS_TRIGGER,DTCH_MEAS_TRIGGER;
+extern MAC_AVG_T BCCH_MEAS_AVG,CCCH_MEAS_AVG,DCCH_MEAS_AVG, DTCH_MEAS_AVG;
+
+extern uint16_t T300[8];
+extern uint16_t T310[8];
+extern uint16_t N310[8];
+extern uint16_t N311[8];
+extern uint32_t T304[8];
+extern uint32_t timeToTrigger_ms[16];
+extern float RSRP_meas_mapping[98];
+extern float RSRQ_meas_mapping[35];
+
+extern UE_PF_PO_t UE_PF_PO[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+extern pthread_mutex_t ue_pf_po_mutex;
+
+extern uint16_t reestablish_rnti_map[NUMBER_OF_UE_MAX][2];
+
+#endif
+
+
diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c
new file mode 100644
index 0000000000000000000000000000000000000000..ef3658af07d21159ce07971573f61eb268fbff7a
--- /dev/null
+++ b/openair2/RRC/NR/rrc_gNB.c
@@ -0,0 +1,7428 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file rrc_gNB.c
+ * \brief rrc procedures for gNB
+ * \author Navid Nikaein and  Raymond Knopp , WEI-TAI CHEN
+ * \date 2011 - 2014 , 2018
+ * \version 1.0
+ * \company Eurecom
+ * \email: navid.nikaein@eurecom.fr and raymond.knopp@eurecom.fr
+ */
+#define RRC_GNB
+#define RRC_GNB_C
+
+#include "defs_NR.h"
+#include "extern.h"
+#include "assertions.h"
+#include "common/ran_context.h"
+#include "asn1_conversions.h"
+
+#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
+#include "LAYER2/RLC/rlc.h"
+#include "LAYER2/MAC/proto.h"
+#include "UTIL/LOG/log.h"
+#include "COMMON/mac_rrc_primitives.h"
+#include "RRC/LITE/MESSAGES/asn1_msg.h"
+
+///ASN.1 header files
+//#include "RRCConnectionRequest.h"
+//#include "RRCConnectionReestablishmentRequest.h"
+//#include "ReestablishmentCause.h"
+#include "BCCH-BCH-Message.h"
+//#include "UL-CCCH-Message.h"
+//#include "DL-CCCH-Message.h"
+#include "UL-DCCH-Message.h"
+#include "DL-DCCH-Message.h"
+//#include "TDD-Config.h"
+//#include "HandoverCommand.h"
+#include "MeasResults.h"
+
+#include "pdcp.h"
+#include "rlc.h"
+#include "SIMULATION/ETH_TRANSPORT/extern.h"
+#include "rrc_eNB_UE_context.h"
+#include "platform_types.h"
+#include "msc.h"
+#include "UTIL/LOG/vcd_signal_dumper.h"
+#include "T.h"
+
+
+#include "RRC/NAS/nas_config.h"
+#include "RRC/NAS/rb_config.h"
+#include "OCG.h"
+#include "OCG_extern.h"
+
+#if defined(ENABLE_SECURITY)
+#   include "UTIL/OSA/osa_defs.h"
+#endif
+
+#if defined(ENABLE_USE_MME)
+#   include "rrc_eNB_S1AP.h"
+#   include "rrc_eNB_GTPV1U.h"
+#   if defined(ENABLE_ITTI)
+#   else
+#      include "../../S1AP/s1ap_eNB.h"
+#   endif
+#endif
+
+#include "gtpv1u_eNB_task.h"
+
+#if defined(ENABLE_ITTI)
+#   include "intertask_interface.h"
+#endif
+
+#if ENABLE_RAL
+#   include "rrc_eNB_ral.h"
+#endif
+
+#include "SIMULATION/TOOLS/defs.h" // for taus
+
+//#define XER_PRINT
+
+extern RAN_CONTEXT_t RC;
+
+#ifdef PHY_EMUL
+extern EMULATION_VARS              *Emul_vars;
+#endif
+extern eNB_MAC_INST                *eNB_mac_inst;
+extern UE_MAC_INST                 *UE_mac_inst;
+#ifdef BIGPHYSAREA
+extern void*                        bigphys_malloc(int);
+#endif
+
+extern uint16_t                     two_tier_hexagonal_cellIds[7];
+
+mui_t                               rrc_eNB_mui = 0;
+
+void
+openair_rrc_on(
+  const protocol_ctxt_t* const ctxt_pP
+)
+//-----------------------------------------------------------------------------
+{
+  int            CC_id;
+
+    LOG_I(NR_RRC, PROTOCOL_RRC_CTXT_FMT" gNB:OPENAIR NR RRC IN....\n",
+          PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
+    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+      rrc_config_buffer (&RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1);
+      RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1;
+      rrc_config_buffer (&RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1);
+      RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1;
+    }
+}
+
+//-----------------------------------------------------------------------------
+static void
+init_SI(
+  const protocol_ctxt_t* const ctxt_pP,
+  const int              CC_id
+#if defined(ENABLE_ITTI)
+  ,
+  RrcConfigurationReq * configuration
+#endif
+)
+//-----------------------------------------------------------------------------
+{
+#if defined(Rel10) || defined(Rel14)
+  int                                 i;
+#endif
+
+#ifdef Rel14
+  SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext=(SystemInformationBlockType1_v1310_IEs_t *)NULL;
+#endif
+
+  LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__);
+
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t*) malloc16(4);
+  // copy basic parameters
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId      = configuration->Nid_cell[CC_id];
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB           = configuration->nb_antenna_ports[CC_id];
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp             = configuration->prefix_type[CC_id];
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq  = configuration->downlink_frequency[CC_id];
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq  = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id];
+#ifdef Rel14
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition = configuration->pbch_repetition[CC_id];
+#endif
+  LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n", 
+	(int)configuration->N_RB_DL[CC_id],
+	(int)configuration->phich_resource[CC_id],
+	(int)configuration->phich_duration[CC_id]);
+  do_MIB(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],
+#ifdef ENABLE_ITTI
+	 configuration->N_RB_DL[CC_id],
+	 configuration->phich_resource[CC_id],
+	 configuration->phich_duration[CC_id]
+#else
+	 50,0,0
+#endif
+	 ,0);
+  
+
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = 0;
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = 0;
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1 = (uint8_t*) malloc16(32);
+
+  AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1 allocated\n",
+	      PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = do_SIB1(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id
+#if defined(ENABLE_ITTI)
+								   , configuration
+#endif
+								   );
+
+  AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255");
+
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23 = (uint8_t*) malloc16(64);
+  AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23!=NULL,"cannot allocate memory for SIB");
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = do_SIB23(
+								     ctxt_pP->module_id,
+								     
+								     CC_id
+#if defined(ENABLE_ITTI)
+								     , configuration
+#endif
+								     );
+
+  AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 != 255,"FATAL, RC.rrc[mod].carrier[CC_id].sizeof_SIB23 == 255");
+  
+
+  LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n",
+	PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
+  LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.n_SB = %ld\n",
+	PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
+	pusch_ConfigBasic.n_SB);
+  LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.hoppingMode = %ld\n",
+	PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
+	pusch_ConfigBasic.hoppingMode);
+  LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.pusch_HoppingOffset = %ld\n",
+	PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
+	pusch_ConfigBasic.pusch_HoppingOffset);
+  LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.enable64QAM = %d\n",
+	PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	(int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
+	pusch_ConfigBasic.enable64QAM);
+  LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupHoppingEnabled = %d\n",
+	PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	(int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
+	ul_ReferenceSignalsPUSCH.groupHoppingEnabled);
+  LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupAssignmentPUSCH = %ld\n",
+	PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
+	ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH);
+  LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.sequenceHoppingEnabled = %d\n",
+	PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	(int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
+	ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled);
+  LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.cyclicShift  = %ld\n",
+	PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
+	ul_ReferenceSignalsPUSCH.cyclicShift);
+  
+#if defined(Rel10) || defined(Rel14)
+
+  if (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag > 0) {
+    for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count; i++) {
+      // SIB 2
+      //   LOG_D(RRC, "[eNB %d] mbsfn_SubframeConfigList.list.count = %ld\n", enb_mod_idP, RC.rrc[enb_mod_idP].sib2->mbsfn_SubframeConfigList->list.count);
+      LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN subframe allocation %d/%d(partial)\n",
+	    PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	    i,
+	    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count);
+      LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" mbsfn_Subframe_pattern is  = %x\n",
+	    PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0] >> 0);
+      LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_period  = %ld (just index number, not the real value)\n",
+	    PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod);   // need to display the real value, using array of char (like in dumping SIB2)
+      LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_offset  = %ld\n",
+	    PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset);
+    }
+    
+    //   SIB13
+    for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count; i++) {
+      LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN sync area %d/%d (partial)\n",
+	    PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	    i,
+	    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count);
+      LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Repetition Period: %ld (just index number, not real value)\n",
+	    PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
+      LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Offset: %ld\n",
+	    PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+	    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9);
+    }
+  }
+  else memset((void*)&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13,0,sizeof(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13));
+#endif
+
+  LOG_D(RRC,
+	PROTOCOL_RRC_CTXT_FMT" RRC_UE --- MAC_CONFIG_REQ (SIB1.tdd & SIB2 params) ---> MAC_UE\n",
+	PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
+
+#ifdef Rel14
+  if ((RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib.message.schedulingInfoSIB1_BR_r13>0) && 
+      (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR!=NULL)) {
+      AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension!=NULL,
+		  "sib2_br->nonCriticalExtension is null (v8.9)\n");
+      AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL,
+		  "sib2_br->nonCriticalExtension is null (v9.2)\n");
+      AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
+		  "sib2_br->nonCriticalExtension is null (v11.3)\n");
+      AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
+		  "sib2_br->nonCriticalExtension is null (v12.5)\n");
+      AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
+		  "sib2_br->nonCriticalExtension is null (v13.10)\n");
+      sib1_v13ext = RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension;
+  }
+#endif
+
+  LOG_D(RRC, "About to call rrc_mac_config_req_eNB\n");
+
+  rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id,
+			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId,
+			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB,
+			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp,
+			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->freqBandIndicator,
+			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq,
+#ifdef Rel14
+			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition,
+#endif
+			 0, // rnti
+			 (BCCH_BCH_Message_t *)
+			 &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib,
+			 (RadioResourceConfigCommonSIB_t *) &
+			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon,
+#if defined(Rel14)
+			 (RadioResourceConfigCommonSIB_t *) &
+			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2_BR->radioResourceConfigCommon,
+#endif
+			 (struct PhysicalConfigDedicated *)NULL,
+#if defined(Rel10) || defined(Rel14)
+			 (SCellToAddMod_r10_t *)NULL,
+			 //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
+			 (MeasObjectToAddMod_t **) NULL,
+			 (MAC_MainConfig_t *) NULL, 0,
+			 (struct LogicalChannelConfig *)NULL,
+			 (MeasGapConfig_t *) NULL,
+			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->tdd_Config,
+			 NULL,
+			 &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->schedulingInfoList,
+			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq,
+			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.ul_Bandwidth,
+			 &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.additionalSpectrumEmission,
+			 (MBSFN_SubframeConfigList_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList
+#if defined(Rel10) || defined(Rel14)
+			 ,
+			 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag,
+			 (MBSFN_AreaInfoList_r9_t*) & RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9,
+			 (PMCH_InfoList_r9_t *) NULL
+#endif
+#ifdef Rel14
+			 , 
+			 sib1_v13ext
+#endif
+			 );
+}
+
+#if defined(Rel10) || defined(Rel14)
+/*------------------------------------------------------------------------------*/
+static void
+init_MCCH(
+  module_id_t enb_mod_idP,
+  int CC_id
+)
+//-----------------------------------------------------------------------------
+{
+
+  int                                 sync_area = 0;
+  // initialize RRC_eNB_INST MCCH entry
+  RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE =
+    malloc(RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t*));
+
+  for (sync_area = 0; sync_area < RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area; sync_area++) {
+
+    RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = 0;
+    RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area] = (uint8_t *) malloc16(32);
+
+    AssertFatal(RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area] != NULL,
+		"[eNB %d]init_MCCH: FATAL, no memory for MCCH MESSAGE allocated \n", enb_mod_idP);
+    RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = do_MBSFNAreaConfig(enb_mod_idP,
+											    sync_area,
+											    (uint8_t *)RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area],
+											    &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch,
+											    &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message);
+    
+    LOG_I(RRC, "mcch message pointer %p for sync area %d \n",
+	  RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area],
+	  sync_area);
+    LOG_D(RRC, "[eNB %d] MCCH_MESSAGE  contents for Sync Area %d (partial)\n", enb_mod_idP, sync_area);
+    LOG_D(RRC, "[eNB %d] CommonSF_AllocPeriod_r9 %ld\n", enb_mod_idP,
+	  RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_AllocPeriod_r9);
+    LOG_D(RRC,
+	  "[eNB %d] CommonSF_Alloc_r9.list.count (number of MBSFN Subframe Pattern) %d\n",
+	  enb_mod_idP, RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.count);
+    LOG_D(RRC, "[eNB %d] MBSFN Subframe Pattern: %02x (in hex)\n",
+	  enb_mod_idP,
+	  RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.array[0]->subframeAllocation.
+	  choice.oneFrame.buf[0]);
+    
+    AssertFatal(RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] != 255,
+		"RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] == 255");
+    RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESS[sync_area].Active = 1;
+  }
+  
+
+  //Set the RC.rrc[enb_mod_idP]->MCCH_MESS.Active to 1 (allow to  transfer MCCH message RRC->MAC in function mac_rrc_data_req)
+
+  // ??Configure MCCH logical channel
+  // call mac_config_req with appropriate structure from ASN.1 description
+
+
+  //  LOG_I(RRC, "DUY: serviceID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->tmgi_r9.serviceId_r9.buf[2]);
+  //  LOG_I(RRC, "DUY: session ID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->sessionId_r9->buf[0]);
+  rrc_mac_config_req_eNB(enb_mod_idP, CC_id,
+			 0,0,0,0,0,
+#ifdef Rel14 
+			 0,
+#endif
+			 0,//rnti
+			 (BCCH_BCH_Message_t *)NULL,
+			 (RadioResourceConfigCommonSIB_t *) NULL,
+#ifdef Rel14
+			 (RadioResourceConfigCommonSIB_t *) NULL,
+#endif
+			 (struct PhysicalConfigDedicated *)NULL,
+#if defined(Rel10) || defined(Rel14)
+			 (SCellToAddMod_r10_t *)NULL,
+			 //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
+			 (MeasObjectToAddMod_t **) NULL,
+			 (MAC_MainConfig_t *) NULL,
+			 0,
+			 (struct LogicalChannelConfig *)NULL,
+			 (MeasGapConfig_t *) NULL,
+			 (TDD_Config_t *) NULL,
+			 (MobilityControlInfo_t *)NULL, 
+			 (SchedulingInfoList_t *) NULL, 
+			 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL
+#if defined(Rel10) || defined(Rel14)
+			 ,
+			 0,
+			 (MBSFN_AreaInfoList_r9_t *) NULL,
+			 (PMCH_InfoList_r9_t *) & (RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9)
+#   endif
+#   ifdef Rel14
+			 ,
+			 (SystemInformationBlockType1_v1310_IEs_t *)NULL
+#   endif
+			 );
+  
+  //LOG_I(RRC,"DUY: lcid after rrc_mac_config_req is %02d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9);
+
+}
+
+//-----------------------------------------------------------------------------
+static void init_MBMS(
+  module_id_t enb_mod_idP,
+  int         CC_id,
+  frame_t frameP
+)
+//-----------------------------------------------------------------------------
+{
+  // init the configuration for MTCH
+  protocol_ctxt_t               ctxt;
+
+  if (RC.rrc[enb_mod_idP]->carrier[CC_id].MBMS_flag > 0) {
+    PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, 0,enb_mod_idP);
+
+    LOG_D(RRC, "[eNB %d] Frame %d : Radio Bearer config request for MBMS\n", enb_mod_idP, frameP);   //check the lcid
+    // Configuring PDCP and RLC for MBMS Radio Bearer
+
+    rrc_pdcp_config_asn1_req(&ctxt,
+                             (SRB_ToAddModList_t  *)NULL,  // SRB_ToAddModList
+                             (DRB_ToAddModList_t  *)NULL,  // DRB_ToAddModList
+                             (DRB_ToReleaseList_t *)NULL,
+                             0,     // security mode
+                             NULL,  // key rrc encryption
+                             NULL,  // key rrc integrity
+                             NULL   // key encryption
+#   if defined(Rel10) || defined(Rel14)
+                             , &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9)
+#   endif
+                             ,NULL);
+
+    rrc_rlc_config_asn1_req(&ctxt,
+                            NULL, // SRB_ToAddModList
+                            NULL,   // DRB_ToAddModList
+                            NULL,   // DRB_ToReleaseList
+                            &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9));
+
+    //rrc_mac_config_req();
+  }
+}
+#endif
+
+//-----------------------------------------------------------------------------
+uint8_t
+rrc_eNB_get_next_transaction_identifier(
+  module_id_t enb_mod_idP
+)
+//-----------------------------------------------------------------------------
+{
+  static uint8_t                      rrc_transaction_identifier[NUMBER_OF_eNB_MAX];
+  rrc_transaction_identifier[enb_mod_idP] = (rrc_transaction_identifier[enb_mod_idP] + 1) % RRC_TRANSACTION_IDENTIFIER_NUMBER;
+  LOG_T(RRC,"generated xid is %d\n",rrc_transaction_identifier[enb_mod_idP]);
+  return rrc_transaction_identifier[enb_mod_idP];
+}
+/*------------------------------------------------------------------------------*/
+/* Functions to handle UE index in eNB UE list */
+
+
+////-----------------------------------------------------------------------------
+//static module_id_t
+//rrc_eNB_get_UE_index(
+//                module_id_t enb_mod_idP,
+//                uint64_t    UE_identity
+//)
+////-----------------------------------------------------------------------------
+//{
+//
+//    boolean_t      reg = FALSE;
+//    module_id_t    i;
+//
+//    AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB index invalid (%d/%d)!", enb_mod_idP, NB_eNB_INST);
+//
+//    for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
+//        if (RC.rrc[enb_mod_idP]->Info.UE_list[i] == UE_identity) {
+//            // UE_identity already registered
+//            reg = TRUE;
+//            break;
+//        }
+//    }
+//
+//    if (reg == FALSE) {
+//        return (UE_MODULE_INVALID);
+//    } else
+//        return (i);
+//}
+
+
+//-----------------------------------------------------------------------------
+// return the ue context if there is already an UE with ue_identityP, NULL otherwise
+static struct rrc_eNB_ue_context_s*
+rrc_eNB_ue_context_random_exist(
+  const protocol_ctxt_t* const ctxt_pP,
+  const uint64_t               ue_identityP
+)
+//-----------------------------------------------------------------------------
+{
+  struct rrc_eNB_ue_context_s*        ue_context_p = NULL;
+  RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
+    if (ue_context_p->ue_context.random_ue_identity == ue_identityP)
+      return ue_context_p;
+  }
+  return NULL;
+}
+//-----------------------------------------------------------------------------
+// return the ue context if there is already an UE with the same S-TMSI(MMEC+M-TMSI), NULL otherwise
+static struct rrc_eNB_ue_context_s*
+rrc_eNB_ue_context_stmsi_exist(
+  const protocol_ctxt_t* const ctxt_pP,
+  const mme_code_t             mme_codeP,
+  const m_tmsi_t               m_tmsiP
+)
+//-----------------------------------------------------------------------------
+{
+  struct rrc_eNB_ue_context_s*        ue_context_p = NULL;
+  RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
+    LOG_I(RRC,"checking for UE S-TMSI %x, mme %x (%p): rnti %x",
+	  m_tmsiP, mme_codeP, ue_context_p, 
+	  ue_context_p->ue_context.rnti);
+    if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
+      printf("=> S-TMSI %x, MME %x\n",
+	    ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
+	    ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code);
+      if (ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi == m_tmsiP)
+        if (ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code == mme_codeP)
+          return ue_context_p;
+    }
+    else
+      printf("\n");
+
+  }
+  return NULL;
+}
+
+//-----------------------------------------------------------------------------
+// return a new ue context structure if ue_identityP, ctxt_pP->rnti not found in collection
+static struct rrc_eNB_ue_context_s*
+rrc_eNB_get_next_free_ue_context(
+  const protocol_ctxt_t* const ctxt_pP,
+  const uint64_t               ue_identityP
+)
+//-----------------------------------------------------------------------------
+{
+  struct rrc_eNB_ue_context_s*        ue_context_p = NULL;
+  ue_context_p = rrc_eNB_get_ue_context(
+					RC.rrc[ctxt_pP->module_id],
+					ctxt_pP->rnti);
+
+  if (ue_context_p == NULL) {
+#if 0
+    RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
+      if (ue_context_p->ue_context.random_ue_identity == ue_identityP) {
+        LOG_D(RRC,
+              PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist rand UE id 0x%"PRIx64", uid %u\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+              ue_identityP,
+              ue_context_p->local_uid);
+        return NULL;
+      }
+    }
+#endif
+    ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[ctxt_pP->module_id]);
+
+    if (ue_context_p == NULL) {
+      LOG_E(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, no memory\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+      return NULL;
+    }
+
+    ue_context_p->ue_id_rnti                    = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else
+    ue_context_p->ue_context.rnti               = ctxt_pP->rnti; // yes duplicate, 1 may be removed
+    ue_context_p->ue_context.random_ue_identity = ue_identityP;
+    RB_INSERT(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p);
+    LOG_D(RRC,
+          PROTOCOL_RRC_CTXT_UE_FMT" Created new UE context uid %u\n",
+          PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+          ue_context_p->local_uid);
+    return ue_context_p;
+
+  } else {
+    LOG_E(RRC,
+          PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist\n",
+          PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+    return NULL;
+  }
+}
+
+#if 0 //!defined(ENABLE_USE_MME)
+void rrc_eNB_emulation_notify_ue_module_id(
+  const module_id_t ue_module_idP,
+  const rnti_t      rntiP,
+  const uint8_t     cell_identity_byte0P,
+  const uint8_t     cell_identity_byte1P,
+  const uint8_t     cell_identity_byte2P,
+  const uint8_t     cell_identity_byte3P)
+{
+  module_id_t                         enb_module_id;
+  struct rrc_eNB_ue_context_s*        ue_context_p = NULL;
+  int                                 CC_id;
+
+  // find enb_module_id
+  for (enb_module_id = 0; enb_module_id < NUMBER_OF_eNB_MAX; enb_module_id++) {
+    if(enb_module_id>0){ /*FIX LATER*/
+      return;
+    }
+    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+      if (&RC.rrc[enb_module_id]->carrier[CC_id].sib1 != NULL) {
+        if (
+          (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[0] == cell_identity_byte0P) &&
+          (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[1] == cell_identity_byte1P) &&
+          (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[2] == cell_identity_byte2P) &&
+          (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[3] == cell_identity_byte3P)
+        ) {
+          ue_context_p = rrc_eNB_get_ue_context(
+                           RC.rrc[enb_module_id],
+                           rntiP
+                         );
+
+          if (NULL != ue_context_p) {
+            oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_module_id][ue_context_p->local_uid] = ue_module_idP;
+          }
+
+          //return;
+        }
+      }
+    }
+    oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_id][ue_module_idP] = rntiP;
+  }
+
+  AssertFatal(enb_module_id == NUMBER_OF_eNB_MAX,
+              "Cell identity not found for ue module id %u rnti %x",
+              ue_module_idP, rntiP);
+}
+#endif
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_free_mem_UE_context(
+  const protocol_ctxt_t*               const ctxt_pP,
+  struct rrc_eNB_ue_context_s*         const ue_context_pP
+)
+//-----------------------------------------------------------------------------
+{
+  int i;
+  LOG_T(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" Clearing UE context 0x%p (free internal structs)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        ue_context_pP);
+#if defined(Rel10) || defined(Rel14)
+  ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[0]);
+  ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[1]);
+#endif
+
+  if (ue_context_pP->ue_context.SRB_configList) {
+    ASN_STRUCT_FREE(asn_DEF_SRB_ToAddModList, ue_context_pP->ue_context.SRB_configList);
+    ue_context_pP->ue_context.SRB_configList = NULL;
+  }
+
+  for(i = 0;i < RRC_TRANSACTION_IDENTIFIER_NUMBER;i++){
+      if (ue_context_pP->ue_context.SRB_configList2[i]) {
+          free(ue_context_pP->ue_context.SRB_configList2[i]);
+          ue_context_pP->ue_context.SRB_configList2[i] = NULL;
+      }
+  }
+
+  if (ue_context_pP->ue_context.DRB_configList) {
+    ASN_STRUCT_FREE(asn_DEF_DRB_ToAddModList, ue_context_pP->ue_context.DRB_configList);
+    ue_context_pP->ue_context.DRB_configList = NULL;
+  }
+
+  for(i = 0;i < RRC_TRANSACTION_IDENTIFIER_NUMBER;i++){
+      if (ue_context_pP->ue_context.DRB_configList2[i]) {
+          free(ue_context_pP->ue_context.DRB_configList2[i]);
+          ue_context_pP->ue_context.DRB_configList2[i] = NULL;
+      }
+      if (ue_context_pP->ue_context.DRB_Release_configList2[i]) {
+          free(ue_context_pP->ue_context.DRB_Release_configList2[i]);
+          ue_context_pP->ue_context.DRB_Release_configList2[i] = NULL;
+      }
+  }
+
+  memset(ue_context_pP->ue_context.DRB_active, 0, sizeof(ue_context_pP->ue_context.DRB_active));
+
+  if (ue_context_pP->ue_context.physicalConfigDedicated) {
+    ASN_STRUCT_FREE(asn_DEF_PhysicalConfigDedicated, ue_context_pP->ue_context.physicalConfigDedicated);
+    ue_context_pP->ue_context.physicalConfigDedicated = NULL;
+  }
+
+  if (ue_context_pP->ue_context.sps_Config) {
+    ASN_STRUCT_FREE(asn_DEF_SPS_Config, ue_context_pP->ue_context.sps_Config);
+    ue_context_pP->ue_context.sps_Config = NULL;
+  }
+
+  for (i=0; i < MAX_MEAS_OBJ; i++) {
+    if (ue_context_pP->ue_context.MeasObj[i] != NULL) {
+      ASN_STRUCT_FREE(asn_DEF_MeasObjectToAddMod, ue_context_pP->ue_context.MeasObj[i]);
+      ue_context_pP->ue_context.MeasObj[i] = NULL;
+    }
+  }
+
+  for (i=0; i < MAX_MEAS_CONFIG; i++) {
+    if (ue_context_pP->ue_context.ReportConfig[i] != NULL) {
+      ASN_STRUCT_FREE(asn_DEF_ReportConfigToAddMod, ue_context_pP->ue_context.ReportConfig[i]);
+      ue_context_pP->ue_context.ReportConfig[i] = NULL;
+    }
+  }
+
+  if (ue_context_pP->ue_context.QuantityConfig) {
+    ASN_STRUCT_FREE(asn_DEF_QuantityConfig, ue_context_pP->ue_context.QuantityConfig);
+    ue_context_pP->ue_context.QuantityConfig = NULL;
+  }
+
+  if (ue_context_pP->ue_context.mac_MainConfig) {
+    ASN_STRUCT_FREE(asn_DEF_MAC_MainConfig, ue_context_pP->ue_context.mac_MainConfig);
+    ue_context_pP->ue_context.mac_MainConfig = NULL;
+  }
+
+/*  if (ue_context_pP->ue_context.measGapConfig) {
+    ASN_STRUCT_FREE(asn_DEF_MeasGapConfig, ue_context_pP->ue_context.measGapConfig);
+    ue_context_pP->ue_context.measGapConfig = NULL;
+  }*/
+    if (ue_context_pP->ue_context.handover_info) {
+      ASN_STRUCT_FREE(asn_DEF_Handover, ue_context_pP->ue_context.handover_info);
+      ue_context_pP->ue_context.handover_info = NULL;
+    }
+
+  //SRB_INFO                           SI;
+  //SRB_INFO                           Srb0;
+  //SRB_INFO_TABLE_ENTRY               Srb1;
+  //SRB_INFO_TABLE_ENTRY               Srb2;
+  if (ue_context_pP->ue_context.measConfig) {
+    ASN_STRUCT_FREE(asn_DEF_MeasConfig, ue_context_pP->ue_context.measConfig);
+    ue_context_pP->ue_context.measConfig = NULL;
+  }
+
+  if (ue_context_pP->ue_context.measConfig) {
+    ASN_STRUCT_FREE(asn_DEF_MeasConfig, ue_context_pP->ue_context.measConfig);
+    ue_context_pP->ue_context.measConfig = NULL;
+  }
+
+  //HANDOVER_INFO                     *handover_info;
+#if defined(ENABLE_SECURITY)
+  //uint8_t kenb[32];
+#endif
+  //e_SecurityAlgorithmConfig__cipheringAlgorithm     ciphering_algorithm;
+  //e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm;
+  //uint8_t                            Status;
+  //rnti_t                             rnti;
+  //uint64_t                           random_ue_identity;
+#if defined(ENABLE_ITTI)
+  //UE_S_TMSI                          Initialue_identity_s_TMSI;
+  //EstablishmentCause_t               establishment_cause;
+  //ReestablishmentCause_t             reestablishment_cause;
+  //uint16_t                           ue_initial_id;
+  //uint32_t                           eNB_ue_s1ap_id :24;
+  //security_capabilities_t            security_capabilities;
+  //uint8_t                            nb_of_e_rabs;
+  //e_rab_param_t                      e_rab[S1AP_MAX_E_RAB];
+  //uint32_t                           enb_gtp_teid[S1AP_MAX_E_RAB];
+  //transport_layer_addr_t             enb_gtp_addrs[S1AP_MAX_E_RAB];
+  //rb_id_t                            enb_gtp_ebi[S1AP_MAX_E_RAB];
+#endif
+}
+
+//-----------------------------------------------------------------------------
+// should be called when UE is lost by eNB
+void
+rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*        const ue_context_pP)
+//-----------------------------------------------------------------------------
+{
+
+
+  protocol_ctxt_t                     ctxt;
+#if !defined(ENABLE_USE_MME)
+  module_id_t                         ue_module_id;
+  /* avoid gcc warnings */
+  (void)ue_module_id;
+#endif
+  rnti_t rnti = ue_context_pP->ue_context.rnti;
+  int i, j , CC_id, pdu_number;
+  LTE_eNB_ULSCH_t *ulsch = NULL;
+  LTE_eNB_DLSCH_t *dlsch = NULL;
+  nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
+  PHY_VARS_eNB *eNB_PHY = NULL;
+  eNB_MAC_INST *eNB_MAC = RC.mac[enb_mod_idP];
+
+  AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB inst invalid (%d/%d) for UE %x!", enb_mod_idP, NB_eNB_INST, rnti);
+  /*  ue_context_p = rrc_eNB_get_ue_context(
+                   &RC.rrc[enb_mod_idP],
+                   rntiP
+                 );
+  */
+  if (NULL != ue_context_pP) {
+    PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, rnti, 0, 0,enb_mod_idP);
+    LOG_W(RRC, "[eNB %d] Removing UE RNTI %x\n", enb_mod_idP, rnti);
+
+#if defined(ENABLE_USE_MME)
+   if( ue_context_pP->ue_context.ul_failure_timer >= 8 ) {
+	LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ RNTI %x\n", enb_mod_idP, rnti);
+    rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); // send cause 21: connection with ue lost
+    /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered)
+     * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before
+     *  triggering the S1 UE Context Release Request procedure
+     *  in order to allow the UE to perform the NAS recovery
+     *  procedure, see TS 23.401 [17].
+     */
+     return;
+    }
+#endif
+    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+      eNB_PHY = RC.eNB[enb_mod_idP][CC_id];
+      for (i=0; i<NUMBER_OF_UE_MAX; i++) {
+        ulsch = eNB_PHY->ulsch[i];
+        if((ulsch != NULL) && (ulsch->rnti == rnti)){
+          LOG_I(RRC, "clean_eNb_ulsch UE %x \n", rnti);
+          clean_eNb_ulsch(ulsch);
+        }
+      }
+      for (i=0; i<NUMBER_OF_UE_MAX; i++) {
+        dlsch = eNB_PHY->dlsch[i][0];
+        if((dlsch != NULL) && (dlsch->rnti == rnti)){
+          LOG_I(RRC, "clean_eNb_dlsch UE %x \n", rnti);
+          clean_eNb_dlsch(dlsch);
+        }
+      }
+
+      if (rrc_agent_registered[enb_mod_idP]) {
+        agent_rrc_xface[enb_mod_idP]->flexran_agent_notify_ue_state_change(enb_mod_idP,
+                              rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
+      }
+
+      for(j = 0; j < 10; j++){
+        ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body;
+        if(ul_req_tmp){
+          pdu_number = ul_req_tmp->number_of_pdus;
+          for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){
+            if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti){
+              LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number);
+              if(pdu_index < pdu_number -1){
+                memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t));
+              }
+              ul_req_tmp->number_of_pdus--;
+            }
+          }
+        }
+      }
+    }
+    rrc_mac_remove_ue(enb_mod_idP,rnti);
+    rrc_rlc_remove_ue(&ctxt);
+    pdcp_remove_UE(&ctxt);
+
+    rrc_eNB_remove_ue_context(
+      &ctxt,
+      RC.rrc[enb_mod_idP],
+      (struct rrc_eNB_ue_context_s*) ue_context_pP);
+  }
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_process_RRCConnectionSetupComplete(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*         ue_context_pP,
+  RRCConnectionSetupComplete_r8_IEs_t * rrcConnectionSetupComplete
+)
+//-----------------------------------------------------------------------------
+{
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing RRCConnectionSetupComplete from UE (SRB1 Active)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+
+  ue_context_pP->ue_context.Srb1.Active=1;  
+  T(T_ENB_RRC_CONNECTION_SETUP_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+#if defined(ENABLE_USE_MME)
+
+  if (EPC_MODE_ENABLED == 1) {
+    // Forward message to S1AP layer
+    rrc_eNB_send_S1AP_NAS_FIRST_REQ(
+      ctxt_pP,
+      ue_context_pP,
+      rrcConnectionSetupComplete);
+  } else
+#endif
+  {
+    // RRC loop back (no S1AP), send SecurityModeCommand to UE
+    rrc_eNB_generate_SecurityModeCommand(
+      ctxt_pP,
+      ue_context_pP);
+    // rrc_eNB_generate_UECapabilityEnquiry(enb_mod_idP,frameP,ue_mod_idP);
+  }
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_SecurityModeCommand(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*          const ue_context_pP
+)
+//-----------------------------------------------------------------------------
+{
+  uint8_t                             buffer[100];
+  uint8_t                             size;
+
+  T(T_ENB_RRC_SECURITY_MODE_COMMAND, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  size = do_SecurityModeCommand(
+           ctxt_pP,
+           buffer,
+           rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
+           ue_context_pP->ue_context.ciphering_algorithm,
+           ue_context_pP->ue_context.integrity_algorithm);
+
+#ifdef RRC_MSG_PRINT
+  uint16_t i=0;
+  LOG_F(RRC,"[MSG] RRC Security Mode Command\n");
+
+  for (i = 0; i < size; i++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
+  }
+
+  LOG_F(RRC,"\n");
+#endif
+
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        size);
+
+  LOG_D(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (securityModeCommand to UE MUI %d) --->[PDCP][RB %02d]\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        size,
+        rrc_eNB_mui,
+        DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" securityModeCommand UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+	       ctxt_pP,
+	       DCCH,
+	       rrc_eNB_mui++,
+	       SDU_CONFIRM_NO,
+	       size,
+	       buffer,
+	       PDCP_TRANSMISSION_MODE_CONTROL);
+
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_UECapabilityEnquiry(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*          const ue_context_pP
+)
+//-----------------------------------------------------------------------------
+{
+
+  uint8_t                             buffer[100];
+  uint8_t                             size;
+
+  T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  size = do_UECapabilityEnquiry(
+           ctxt_pP,
+           buffer,
+           rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id));
+
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate UECapabilityEnquiry (bytes %d)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        size);
+
+  LOG_D(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (UECapabilityEnquiry MUI %d) --->[PDCP][RB %02d]\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        size,
+        rrc_eNB_mui,
+        DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" rrcUECapabilityEnquiry UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+	       ctxt_pP,
+	       DCCH,
+	       rrc_eNB_mui++,
+	       SDU_CONFIRM_NO,
+	       size,
+	       buffer,
+	       PDCP_TRANSMISSION_MODE_CONTROL);
+
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_RRCConnectionReject(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*          const ue_context_pP,
+  const int                    CC_id
+)
+//-----------------------------------------------------------------------------
+{
+#ifdef RRC_MSG_PRINT
+  int                                 cnt;
+#endif
+
+  T(T_ENB_RRC_CONNECTION_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
+    do_RRCConnectionReject(ctxt_pP->module_id,
+                          (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload);
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRCConnectionReject\n");
+
+  for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->Srb0.Tx_buffer.Payload)[cnt]);
+  }
+
+  LOG_F(RRC,"\n");
+#endif
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header,
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+    MSC_AS_TIME_FMT" RRCConnectionReject UE %x size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti,
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReject (bytes %d)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_RRCConnectionReestablishment(
+  const protocol_ctxt_t*         const ctxt_pP,
+  rrc_eNB_ue_context_t*          const ue_context_pP,
+  const int                            CC_id
+)
+//-----------------------------------------------------------------------------
+{
+  LogicalChannelConfig_t             *SRB1_logicalChannelConfig;
+  SRB_ToAddModList_t                 **SRB_configList;
+  SRB_ToAddMod_t                     *SRB1_config;
+  int                                 cnt;
+
+  T(T_ENB_RRC_CONNECTION_REESTABLISHMENT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  SRB_configList = &ue_context_pP->ue_context.SRB_configList;
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
+    do_RRCConnectionReestablishment(ctxt_pP,
+                                    ue_context_pP,
+                                    CC_id,
+                                    (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload,
+                                    (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2
+                                    rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
+                                    SRB_configList,
+                                    &ue_context_pP->ue_context.physicalConfigDedicated);
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRCConnectionReestablishment\n");
+
+  for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload)[cnt]);
+  }
+
+  LOG_F(RRC,"\n");
+#endif
+
+  // configure SRB1 for UE
+
+  if (*SRB_configList != NULL) {
+    for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) {
+      if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) {
+        SRB1_config = (*SRB_configList)->list.array[cnt];
+
+        if (SRB1_config->logicalChannelConfig) {
+          if (SRB1_config->logicalChannelConfig->present ==
+              SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) {
+            SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue;
+          } else {
+            SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
+          }
+        } else {
+          SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
+        }
+
+        LOG_D(RRC,
+              PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ  (SRB1) ---> MAC_eNB\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+        rrc_mac_config_req_eNB(ctxt_pP->module_id,
+                           ue_context_pP->ue_context.primaryCC_id,
+                           0,0,0,0,0,
+#ifdef Rel14 
+			 0,
+#endif
+                           ctxt_pP->rnti,
+                           (BCCH_BCH_Message_t *) NULL, 
+                           (RadioResourceConfigCommonSIB_t *) NULL,
+#ifdef Rel14
+                           (RadioResourceConfigCommonSIB_t *) NULL,
+#endif
+                           (struct PhysicalConfigDedicated* ) ue_context_pP->ue_context.physicalConfigDedicated,
+#if defined(Rel10) || defined(Rel14)
+                           (SCellToAddMod_r10_t *)NULL,
+                           //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
+                           (MeasObjectToAddMod_t **) NULL,
+                           ue_context_pP->ue_context.mac_MainConfig,
+                           1,
+                           SRB1_logicalChannelConfig,
+                           ue_context_pP->ue_context.measGapConfig,
+                           (TDD_Config_t *) NULL,
+                           NULL,
+                           (SchedulingInfoList_t *) NULL,
+                           0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL
+#if defined(Rel10) || defined(Rel14)
+                           , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL
+#endif
+#ifdef Rel14
+                           ,(SystemInformationBlockType1_v1310_IEs_t *)NULL 
+#endif
+        );
+        break;
+      }
+    }
+  }
+
+  MSC_LOG_TX_MESSAGE(MSC_RRC_ENB,
+                     MSC_RRC_UE,
+                     RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header,
+                     RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+                     MSC_AS_TIME_FMT" RRCConnectionReestablishment UE %x size %u",
+                     MSC_AS_TIME_ARGS(ctxt_pP),
+                     ue_context_pP->ue_context.rnti,
+                     RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+
+
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishment (bytes %d)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+
+  // activate release timer, if RRCComplete not received after 10 frames, remove UE
+  //ue_context_pP->ue_context.ue_release_timer = 1;
+  // remove UE after 10 frames after RRCConnectionReestablishmentRelease is triggered
+  //ue_context_pP->ue_context.ue_release_timer_thres = 100;
+    // activate release timer, if RRCComplete not received after 100 frames, remove UE
+  int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti);
+  RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1;
+  // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered
+  RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 1000;
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_process_RRCConnectionReestablishmentComplete(
+  const protocol_ctxt_t* const ctxt_pP,
+  const rnti_t reestablish_rnti,
+  rrc_eNB_ue_context_t*         ue_context_pP,
+  const uint8_t xid,
+  RRCConnectionReestablishmentComplete_r8_IEs_t * rrcConnectionReestablishmentComplete
+)
+//-----------------------------------------------------------------------------
+{
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, processing RRCConnectionReestablishmentComplete from UE (SRB1 Active)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+
+  T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  DRB_ToAddModList_t*                 DRB_configList = ue_context_pP->ue_context.DRB_configList;
+  SRB_ToAddModList_t*                 SRB_configList = ue_context_pP->ue_context.SRB_configList;
+  SRB_ToAddModList_t**                SRB_configList2 = NULL;
+  DRB_ToAddModList_t**                DRB_configList2 = NULL;
+  struct SRB_ToAddMod                *SRB2_config = NULL;
+  struct DRB_ToAddMod                *DRB_config = NULL;
+  int i = 0;
+# if defined(ENABLE_USE_MME)
+  int j = 0;
+  hashtable_rc_t                      h_rc;
+#endif
+  uint8_t                             buffer[RRC_BUF_SIZE];
+  uint16_t                            size;
+  MeasObjectToAddModList_t           *MeasObj_list                     = NULL;
+  MeasObjectToAddMod_t               *MeasObj                          = NULL;
+  ReportConfigToAddModList_t         *ReportConfig_list                = NULL;
+  ReportConfigToAddMod_t             *ReportConfig_per, *ReportConfig_A1,
+                                     *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5;
+  MeasIdToAddModList_t               *MeasId_list                      = NULL;
+  MeasIdToAddMod_t                   *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5;
+  RSRP_Range_t                       *rsrp                             = NULL;
+  struct MeasConfig__speedStatePars  *Sparams                          = NULL;
+  QuantityConfig_t                   *quantityConfig                   = NULL;
+  CellsToAddMod_t                    *CellToAdd                        = NULL;
+  CellsToAddModList_t                *CellsToAddModList                = NULL;
+  struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
+  DedicatedInfoNAS_t                 *dedicatedInfoNas                 = NULL;
+  /* for no gcc warnings */
+  (void)dedicatedInfoNas;
+  C_RNTI_t                           *cba_RNTI                         = NULL;
+  uint8_t next_xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id);
+
+  ue_context_pP->ue_context.Status = RRC_CONNECTED;
+
+  SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid];
+  // get old configuration of SRB2
+  if (*SRB_configList2 != NULL) {
+    LOG_D(RRC, "SRB_configList2(%p) count is %d\n           SRB_configList2->list.array[0] addr is %p",
+          SRB_configList2, (*SRB_configList2)->list.count,  (*SRB_configList2)->list.array[0]);
+    for (i = 0; (i < (*SRB_configList2)->list.count) && (i < 3); i++) {
+      if ((*SRB_configList2)->list.array[i]->srb_Identity == 2 ){
+        LOG_D(RRC, "get SRB2_config from (ue_context_pP->ue_context.SRB_configList2[%d])\n", xid);
+        SRB2_config = (*SRB_configList2)->list.array[i];
+        break;
+      }
+    }
+  }
+  SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[next_xid];
+  DRB_configList2 = &ue_context_pP->ue_context.DRB_configList2[next_xid];
+
+  if (*SRB_configList2) {
+    free(*SRB_configList2);
+    LOG_D(RRC, "free(ue_context_pP->ue_context.SRB_configList2[%d])\n", next_xid);
+  }
+  *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2));
+  if (SRB2_config != NULL) {
+    // Add SRB2 to SRB configuration list
+
+    ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
+    ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config);
+
+    LOG_D(RRC, "Add SRB2_config (srb_Identity:%ld) to ue_context_pP->ue_context.SRB_configList\n",
+            SRB2_config->srb_Identity);
+    LOG_D(RRC, "Add SRB2_config (srb_Identity:%ld) to ue_context_pP->ue_context.SRB_configList2[%d]\n",
+                SRB2_config->srb_Identity, next_xid);
+  } else {
+    // SRB configuration list only contains SRB1.
+    LOG_W(RRC,"SRB2 configuration does not exist in SRB configuration list\n");
+  }
+
+
+
+  if (*DRB_configList2) {
+    free(*DRB_configList2);
+    LOG_D(RRC, "free(ue_context_pP->ue_context.DRB_configList2[%d])\n", next_xid);
+  }
+  *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2));
+
+  if (DRB_configList != NULL) {
+    LOG_D(RRC, "get DRB_config from (ue_context_pP->ue_context.DRB_configList)\n");
+    for (i = 0; (i < DRB_configList->list.count) && (i < 3); i++) {
+      DRB_config = DRB_configList->list.array[i];
+
+      // Add DRB to DRB configuration list, for RRCConnectionReconfigurationComplete
+      ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
+    }
+  }
+  ue_context_pP->ue_context.Srb1.Active = 1;
+  //ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = 2;
+
+# if defined(ENABLE_USE_MME)
+  rrc_ue_s1ap_ids_t* rrc_ue_s1ap_ids_p = NULL;
+  uint16_t ue_initial_id = ue_context_pP->ue_context.ue_initial_id;
+  uint32_t eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id;
+  eNB_RRC_INST *rrc_instance_p = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)];
+  if (eNB_ue_s1ap_id > 0) {
+    h_rc = hashtable_get(rrc_instance_p->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void**)&rrc_ue_s1ap_ids_p);
+    if  (h_rc == HASH_TABLE_OK) {
+      rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti;
+    }
+  }
+  if (ue_initial_id != 0) {
+    h_rc = hashtable_get(rrc_instance_p->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void**)&rrc_ue_s1ap_ids_p);
+    if  (h_rc == HASH_TABLE_OK) {
+      rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti;
+    }
+  }
+
+  gtpv1u_enb_create_tunnel_req_t  create_tunnel_req;
+
+  /* Save e RAB information for later */
+  memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req));
+
+  for (j = 0, i = 0; i < NB_RB_MAX; i++) {
+    if (ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED) {
+      create_tunnel_req.eps_bearer_id[j]       = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;
+      create_tunnel_req.sgw_S1u_teid[j]        = ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
+
+      memcpy(&create_tunnel_req.sgw_addr[j],
+             &ue_context_pP->ue_context.e_rab[i].param.sgw_addr,
+             sizeof(transport_layer_addr_t));
+      j++;
+    }
+  }
+
+  create_tunnel_req.rnti       = ctxt_pP->rnti; // warning put zero above
+  create_tunnel_req.num_tunnels    = j;
+
+  gtpv1u_update_s1u_tunnel(
+            ctxt_pP->instance,
+            &create_tunnel_req,
+            reestablish_rnti);
+#endif
+  /* Update RNTI in ue_context */
+  ue_context_pP->ue_id_rnti                    = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else
+  ue_context_pP->ue_context.rnti               = ctxt_pP->rnti;
+# if defined(ENABLE_USE_MME)
+  uint8_t send_security_mode_command = FALSE;
+  rrc_pdcp_config_security(
+      ctxt_pP,
+      ue_context_pP,
+      send_security_mode_command);
+  LOG_D(RRC, "set security successfully \n");
+#endif
+  // Measurement ID list
+  MeasId_list = CALLOC(1, sizeof(*MeasId_list));
+  memset((void *)MeasId_list, 0, sizeof(*MeasId_list));
+
+  MeasId0 = CALLOC(1, sizeof(*MeasId0));
+  MeasId0->measId = 1;
+  MeasId0->measObjectId = 1;
+  MeasId0->reportConfigId = 1;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0);
+
+  MeasId1 = CALLOC(1, sizeof(*MeasId1));
+  MeasId1->measId = 2;
+  MeasId1->measObjectId = 1;
+  MeasId1->reportConfigId = 2;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1);
+
+  MeasId2 = CALLOC(1, sizeof(*MeasId2));
+  MeasId2->measId = 3;
+  MeasId2->measObjectId = 1;
+  MeasId2->reportConfigId = 3;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2);
+
+  MeasId3 = CALLOC(1, sizeof(*MeasId3));
+  MeasId3->measId = 4;
+  MeasId3->measObjectId = 1;
+  MeasId3->reportConfigId = 4;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3);
+
+  MeasId4 = CALLOC(1, sizeof(*MeasId4));
+  MeasId4->measId = 5;
+  MeasId4->measObjectId = 1;
+  MeasId4->reportConfigId = 5;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4);
+
+  MeasId5 = CALLOC(1, sizeof(*MeasId5));
+  MeasId5->measId = 6;
+  MeasId5->measObjectId = 1;
+  MeasId5->reportConfigId = 6;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5);
+
+  //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list;
+
+  // Add one EUTRA Measurement Object
+  MeasObj_list = CALLOC(1, sizeof(*MeasObj_list));
+  memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list));
+
+  // Configure MeasObject
+
+  MeasObj = CALLOC(1, sizeof(*MeasObj));
+  memset((void *)MeasObj, 0, sizeof(*MeasObj));
+
+  MeasObj->measObjectId = 1;
+  MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA;
+  MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz
+  //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz
+  MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25;
+  MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t));
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6;
+  MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL;   // Default is 15 or 0dB
+
+  MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList =
+    (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList));
+
+  CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList;
+
+  // Add adjacent cell lists (6 per eNB)
+  for (i = 0; i < 6; i++) {
+    CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd));
+    CellToAdd->cellIndex = i + 1;
+    CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i);
+    CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0;
+
+    ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd);
+  }
+
+  ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj);
+  //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
+
+  // Report Configurations for periodical, A1-A5 events
+  ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list));
+
+  ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per));
+
+  ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1));
+
+  ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2));
+
+  ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3));
+
+  ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4));
+
+  ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5));
+
+  ReportConfig_per->reportConfigId = 1;
+  ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_periodical;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose =
+    ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per);
+
+  ReportConfig_A1->reportConfigId = 2;
+  ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_event;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+    ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
+  a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
+  a1_Threshold.choice.threshold_RSRP = 10;
+
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1);
+
+  if (RC.rrc[ctxt_pP->module_id]->HO_flag == 1 /*HO_MEASURMENT */ ) {
+    LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n",
+          ctxt_pP->module_id, ctxt_pP->frame);
+    ReportConfig_A2->reportConfigId = 3;
+    ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA2.a2_Threshold.choice.threshold_RSRP = 10;
+
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2);
+
+    ReportConfig_A3->reportConfigId = 4;
+    ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3;
+
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1;   //10;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA3.reportOnLeave = 1;
+
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long!
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger =
+      TimeToTrigger_ms40;
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3);
+
+    ReportConfig_A4->reportConfigId = 5;
+    ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA4.a4_Threshold.choice.threshold_RSRP = 10;
+
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4);
+
+    ReportConfig_A5->reportConfigId = 6;
+    ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold1.choice.threshold_RSRP = 10;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold2.choice.threshold_RSRP = 10;
+
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5);
+    //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list;
+
+    rsrp = CALLOC(1, sizeof(RSRP_Range_t));
+    *rsrp = 20;
+
+    Sparams = CALLOC(1, sizeof(*Sparams));
+    Sparams->present = MeasConfig__speedStatePars_PR_setup;
+    Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75;
+    Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5;
+    Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10;
+    Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5;
+    Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60;
+    Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120;
+
+    quantityConfig = CALLOC(1, sizeof(*quantityConfig));
+    memset((void *)quantityConfig, 0, sizeof(*quantityConfig));
+    quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA));
+    memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA));
+    quantityConfig->quantityConfigCDMA2000 = NULL;
+    quantityConfig->quantityConfigGERAN = NULL;
+    quantityConfig->quantityConfigUTRA = NULL;
+    quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP =
+      CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP)));
+    quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ =
+      CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)));
+    *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4;
+    *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4;
+
+    LOG_I(RRC,
+          "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n",
+          ctxt_pP->module_id, ctxt_pP->frame);
+    // store the information in an intermediate structure for Hanodver management
+    //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof());
+    ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info)));
+    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = *SRB_configList2;
+    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = DRB_configList;
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL;
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig =
+      CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig));
+    memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig,
+           (void *)ue_context_pP->ue_context.mac_MainConfig, sizeof(MAC_MainConfig_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated =
+      CALLOC(1, sizeof(PhysicalConfigDedicated_t));
+    memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated,
+           (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL;
+    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t));
+
+  }
+
+#ifdef CBA
+  //struct PUSCH_CBAConfigDedicated_vlola  *pusch_CBAConfigDedicated_vlola;
+  uint8_t                            *cba_RNTI_buf;
+  cba_RNTI = CALLOC(1, sizeof(C_RNTI_t));
+  cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t));
+  cba_RNTI->buf = cba_RNTI_buf;
+  cba_RNTI->size = 2;
+  cba_RNTI->bits_unused = 0;
+
+  // associate UEs to the CBa groups as a function of their UE id
+  if (rrc_inst->num_active_cba_groups) {
+    cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff;
+    cba_RNTI->buf[1] = 0xff;
+    LOG_D(RRC,
+          "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n",
+          enb_mod_idP, frameP,
+          rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups],
+          ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP);
+  } else {
+    cba_RNTI->buf[0] = 0x0;
+    cba_RNTI->buf[1] = 0x0;
+    LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP);
+  }
+
+#endif
+
+#if defined(ENABLE_ITTI)
+  /* Initialize NAS list */
+  dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
+
+  /* Add all NAS PDUs to the list */
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
+    if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
+      dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t));
+      memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t));
+      OCTET_STRING_fromBuf(dedicatedInfoNas,
+         (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer,
+                           ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length);
+      LOG_D(RRC, "Add dedicatedInfoNas(%d) to dedicatedInfoNASList\n", i);
+      ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
+    }
+
+    /* TODO parameters yet to process ... */
+    {
+      //      ue_context_pP->ue_context.e_rab[i].param.qos;
+      //      ue_context_pP->ue_context.e_rab[i].param.sgw_addr;
+      //      ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
+    }
+
+    /* TODO should test if e RAB are Ok before! */
+    ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE;
+    LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n",
+    i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE");
+  }
+
+  /* If list is empty free the list and reset the address */
+  if (dedicatedInfoNASList->list.count == 0) {
+    free(dedicatedInfoNASList);
+    dedicatedInfoNASList = NULL;
+  }
+
+#endif
+
+  // send RRCConnectionReconfiguration
+  memset(buffer, 0, RRC_BUF_SIZE);
+
+  size = do_RRCConnectionReconfiguration(ctxt_pP,
+                                         buffer,
+                                         next_xid,   //Transaction_id,
+                                         (SRB_ToAddModList_t*)*SRB_configList2, // SRB_configList
+                                         (DRB_ToAddModList_t*)DRB_configList,
+                                         (DRB_ToReleaseList_t*)NULL,  // DRB2_list,
+                                         (struct SPS_Config*)NULL,    // maybe ue_context_pP->ue_context.sps_Config,
+                                         (struct PhysicalConfigDedicated*)ue_context_pP->ue_context.physicalConfigDedicated,
+#ifdef EXMIMO_IOT
+                                         NULL, NULL, NULL,NULL,
+#else
+                                         (MeasObjectToAddModList_t*)MeasObj_list,  // MeasObj_list,
+                                         (ReportConfigToAddModList_t*)ReportConfig_list,  // ReportConfig_list,
+                                         (QuantityConfig_t*)quantityConfig,  //quantityConfig,
+                                         (MeasIdToAddModList_t*)NULL,
+#endif
+                                         (MAC_MainConfig_t*)ue_context_pP->ue_context.mac_MainConfig,
+                                         (MeasGapConfig_t*)NULL,
+                                         (MobilityControlInfo_t*)NULL,
+                                         (struct MeasConfig__speedStatePars*)Sparams, // Sparams,
+                                         (RSRP_Range_t*)rsrp, // rsrp,
+                                         (C_RNTI_t*)cba_RNTI,  // cba_RNTI
+                                         (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList //dedicatedInfoNASList
+#if defined(Rel10) || defined(Rel14)
+                                         , (SCellToAddMod_r10_t*)NULL
+#endif
+                                        );
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n");
+  for (i = 0; i < size; i++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
+  }
+  LOG_F(RRC,"\n");
+  ////////////////////////////////////////
+#endif
+
+#if defined(ENABLE_ITTI)
+
+  /* Free all NAS PDUs */
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
+    if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
+      /* Free the NAS PDU buffer and invalidate it */
+      free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer);
+      ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL;
+    }
+  }
+
+#endif
+
+  LOG_I(RRC,
+        "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n",
+        ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
+
+  LOG_D(RRC,
+        "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
+        ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+         ctxt_pP,
+         DCCH,
+         rrc_eNB_mui++,
+         SDU_CONFIRM_NO,
+         size,
+         buffer,
+         PDCP_TRANSMISSION_MODE_CONTROL);
+
+  // delete UE data of prior RNTI.  UE use current RNTI.
+  protocol_ctxt_t ctxt_prior = *ctxt_pP;
+  ctxt_prior.rnti = reestablish_rnti;
+
+  LTE_eNB_ULSCH_t *ulsch = NULL;
+  nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
+  PHY_VARS_eNB *eNB_PHY = NULL;
+  eNB_MAC_INST *eNB_MAC = RC.mac[ctxt_prior.module_id];
+  for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+    eNB_PHY = RC.eNB[ctxt_prior.module_id][CC_id];
+    for (int i=0; i<NUMBER_OF_UE_MAX; i++) {
+      ulsch = eNB_PHY->ulsch[i];
+      if((ulsch != NULL) && (ulsch->rnti == ctxt_prior.rnti)){
+        LOG_I(RRC, "clean_eNb_ulsch UE %x \n", ctxt_prior.rnti);
+        clean_eNb_ulsch(ulsch);
+        break;
+      }
+    }
+
+    for(int j = 0; j < 10; j++){
+      ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body;
+      if(ul_req_tmp){
+        int pdu_number = ul_req_tmp->number_of_pdus;
+        for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){
+          if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == ctxt_prior.rnti){
+            LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", ctxt_prior.rnti, pdu_index, pdu_number);
+            if(pdu_index < pdu_number -1){
+               memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t));
+            }
+            ul_req_tmp->number_of_pdus--;
+          }
+        }
+      }
+    }
+  }
+  rrc_mac_remove_ue(ctxt_prior.module_id, ctxt_prior.rnti);
+  rrc_rlc_remove_ue(&ctxt_prior);
+  pdcp_remove_UE(&ctxt_prior);
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_RRCConnectionReestablishmentReject(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*          const ue_context_pP,
+  const int                    CC_id
+)
+//-----------------------------------------------------------------------------
+{
+#ifdef RRC_MSG_PRINT
+  int                                 cnt;
+#endif
+  int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti);
+  RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1;
+  RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 20;
+
+  T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
+    do_RRCConnectionReestablishmentReject(ctxt_pP->module_id,
+                          (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload);
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRCConnectionReestablishmentReject\n");
+
+  for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload)[cnt]);
+  }
+
+  LOG_F(RRC,"\n");
+#endif
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header,
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+    MSC_AS_TIME_FMT" RRCConnectionReestablishmentReject UE %x size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti,
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishmentReject (bytes %d)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_RRCConnectionRelease(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*          const ue_context_pP
+)
+//-----------------------------------------------------------------------------
+{
+
+  uint8_t                             buffer[RRC_BUF_SIZE];
+  uint16_t                            size;
+
+  T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  memset(buffer, 0, RRC_BUF_SIZE);
+
+  size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id));
+  // set release timer
+  //ue_context_pP->ue_context.ue_release_timer=1;
+  // remove UE after 10 frames after RRCConnectionRelease is triggered
+  //ue_context_pP->ue_context.ue_release_timer_thres=100;
+    // set release timer
+  ue_context_pP->ue_context.ue_release_timer_rrc = 1;
+  // remove UE after 10 frames after RRCConnectionRelease is triggered
+  ue_context_pP->ue_context.ue_release_timer_thres_rrc = 100;
+  ue_context_pP->ue_context.ue_reestablishment_timer = 0;
+  ue_context_pP->ue_context.ue_release_timer = 0;
+  ue_context_pP->ue_context.ue_release_timer_s1 = 0;
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate RRCConnectionRelease (bytes %d)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        size);
+
+  LOG_D(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (rrcConnectionRelease MUI %d) --->[PDCP][RB %u]\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        size,
+        rrc_eNB_mui,
+        DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" rrcConnectionRelease UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+	       ctxt_pP,
+	       DCCH,
+	       rrc_eNB_mui++,
+	       SDU_CONFIRM_NO,
+	       size,
+	       buffer,
+	       PDCP_TRANSMISSION_MODE_CONTROL);
+}
+
+uint8_t qci_to_priority[9]={2,4,3,5,1,6,7,8,9};
+
+// TBD: this directive can be remived if we create a similar e_rab_param_t structure in RRC context
+#if defined(ENABLE_ITTI) 
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP,
+						     rrc_eNB_ue_context_t*          const ue_context_pP,
+						     const uint8_t                ho_state
+						     )
+//-----------------------------------------------------------------------------
+{
+  
+  uint8_t                             buffer[RRC_BUF_SIZE];
+  uint16_t                            size;
+  int i;
+  
+  struct DRB_ToAddMod                *DRB_config                       = NULL;
+  struct RLC_Config                  *DRB_rlc_config                   = NULL;
+  struct PDCP_Config                 *DRB_pdcp_config                  = NULL;
+  struct PDCP_Config__rlc_AM         *PDCP_rlc_AM                      = NULL;
+  struct PDCP_Config__rlc_UM         *PDCP_rlc_UM                      = NULL;
+  struct LogicalChannelConfig        *DRB_lchan_config                 = NULL;
+  struct LogicalChannelConfig__ul_SpecificParameters
+    *DRB_ul_SpecificParameters        = NULL;
+  //  DRB_ToAddModList_t**                DRB_configList=&ue_context_pP->ue_context.DRB_configList; 
+  DRB_ToAddModList_t*                DRB_configList=ue_context_pP->ue_context.DRB_configList; 
+  DRB_ToAddModList_t**                DRB_configList2=NULL;
+  //DRB_ToAddModList_t**                RRC_DRB_configList=&ue_context_pP->ue_context.DRB_configList;
+
+  struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
+  DedicatedInfoNAS_t                 *dedicatedInfoNas                 = NULL;
+  /* for no gcc warnings */
+  (void)dedicatedInfoNas;
+
+  long  *logicalchannelgroup_drb;
+//  int drb_identity_index=0;
+
+  uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id);   //Transaction_id,
+  DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid];
+  if (*DRB_configList2) {
+    free(*DRB_configList2);
+  }
+  //*DRB_configList = CALLOC(1, sizeof(*DRB_configList));
+  *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); 
+  /* Initialize NAS list */
+  dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
+
+  int e_rab_done=0;
+  
+  for ( i = 0  ;
+	i < ue_context_pP->ue_context.setup_e_rabs ;
+	i++){
+
+    if (e_rab_done >= ue_context_pP->ue_context.nb_of_e_rabs){
+        break;
+    }
+    
+    // bypass the new and already configured erabs
+    if (ue_context_pP->ue_context.e_rab[i].status >= E_RAB_STATUS_DONE) {
+//      drb_identity_index++;
+      continue;
+    }
+        
+    DRB_config = CALLOC(1, sizeof(*DRB_config));
+
+    DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long));
+    // allowed value 5..15, value : x+4
+    *(DRB_config->eps_BearerIdentity) = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;//+ 4; // especial case generation  
+
+ //   DRB_config->drb_Identity =  1 + drb_identity_index + e_rab_done;// + i ;// (DRB_Identity_t) ue_context_pP->ue_context.e_rab[i].param.e_rab_id;
+    // 1 + drb_identiy_index;  
+    DRB_config->drb_Identity = i+1;
+
+    DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long));
+    *(DRB_config->logicalChannelIdentity) = DRB_config->drb_Identity + 2; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
+    
+    DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config));
+    DRB_config->rlc_Config = DRB_rlc_config;
+
+    DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
+    DRB_config->pdcp_Config = DRB_pdcp_config;
+    DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
+    *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity;
+    DRB_pdcp_config->rlc_AM = NULL;
+    DRB_pdcp_config->rlc_UM = NULL;
+
+
+    switch (ue_context_pP->ue_context.e_rab[i].param.qos.qci){
+      /*
+       * type: realtime data with medium packer error rate
+       * action: swtich to RLC UM
+       */
+    case 1: // 100ms, 10^-2, p2, GBR
+    case 2: // 150ms, 10^-3, p4, GBR
+    case 3: // 50ms, 10^-3, p3, GBR
+    case 4:  // 300ms, 10^-6, p5 
+    case 7: // 100ms, 10^-3, p7, GBR
+    case 9: // 300ms, 10^-6, p9
+    case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR
+    case 66: // 100ms, 10^-2, p2, non-mission critical  voice , GBR
+      // RLC 
+      DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional;
+      DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+      DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+      DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35;
+      // PDCP
+      PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM));
+      DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
+      PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
+      break;
+      
+      /*
+       * type: non-realtime data with low packer error rate
+       * action: swtich to RLC AM
+       */
+    case 5:  // 100ms, 10^-6, p1 , IMS signaling 
+    case 6:  // 300ms, 10^-6, p6 
+    case 8: // 300ms, 10^-6, p8 
+    case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority 
+    case 70: // 200ms, 10^-6, p5.5, mision critical data 
+      // RLC
+       DRB_rlc_config->present = RLC_Config_PR_am;
+       DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50;
+       DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16;
+       DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity;
+       DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8;
+       DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
+       DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25;
+
+       // PDCP
+       PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM));
+       DRB_pdcp_config->rlc_AM = PDCP_rlc_AM;
+       PDCP_rlc_AM->statusReportRequired = FALSE;
+       
+       break;
+    default :
+      LOG_E(RRC,"not supported qci %d\n", ue_context_pP->ue_context.e_rab[i].param.qos.qci);
+      ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_FAILED; 
+      ue_context_pP->ue_context.e_rab[i].xid = xid;
+      e_rab_done++;
+      continue;
+    }
+
+    DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed;
+    
+    DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config));
+    DRB_config->logicalChannelConfig = DRB_lchan_config;
+    DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
+    DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
+
+    if (ue_context_pP->ue_context.e_rab[i].param.qos.qci < 9 )
+      DRB_ul_SpecificParameters->priority = qci_to_priority[ue_context_pP->ue_context.e_rab[i].param.qos.qci-1] + 3; 
+    // ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.priority_level;
+    else 
+      DRB_ul_SpecificParameters->priority= 4;
+
+    DRB_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8;
+      //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+    DRB_ul_SpecificParameters->bucketSizeDuration =
+      LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+    
+    logicalchannelgroup_drb = CALLOC(1, sizeof(long));
+    *logicalchannelgroup_drb = 1;//(i+1) % 3;
+    DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
+
+    ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config);
+    ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
+    //ue_context_pP->ue_context.DRB_configList2[drb_identity_index] = &(*DRB_configList);
+    
+    LOG_I(RRC,"EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n",
+	  *DRB_config->eps_BearerIdentity,
+	  DRB_config->drb_Identity, i,
+	  ue_context_pP->ue_context.e_rab[i].param.qos.qci,
+	  DRB_ul_SpecificParameters->priority,
+	  *(DRB_config->logicalChannelIdentity),
+	  *DRB_ul_SpecificParameters->logicalChannelGroup	  
+	  );
+
+    e_rab_done++;
+    ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; 
+    ue_context_pP->ue_context.e_rab[i].xid = xid;
+    
+    {
+      if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
+	dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t));
+	memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t));
+	OCTET_STRING_fromBuf(dedicatedInfoNas, 
+			     (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer,
+			     ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length);
+	ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
+	LOG_I(RRC,"add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length, i);
+      } 
+      else {
+	LOG_W(RRC,"Not received activate dedicated EPS bearer context request\n");
+      }
+      /* TODO parameters yet to process ... */
+      {
+	//      ue_context_pP->ue_context.e_rab[i].param.qos;
+	//      ue_context_pP->ue_context.e_rab[i].param.sgw_addr;
+	//      ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
+      }
+    }
+    
+  }
+
+  /* If list is empty free the list and reset the address */
+  if (dedicatedInfoNASList != NULL) {
+    if (dedicatedInfoNASList->list.count == 0) {
+      free(dedicatedInfoNASList);
+      dedicatedInfoNASList = NULL;
+      LOG_W(RRC,"dedlicated NAS list is empty, free the list and reset the address\n");
+    }				
+  } else {
+    LOG_W(RRC,"dedlicated NAS list is empty\n");
+  }
+
+  memset(buffer, 0, RRC_BUF_SIZE);
+
+   size = do_RRCConnectionReconfiguration(ctxt_pP,
+					  buffer,
+					  xid,
+					  (SRB_ToAddModList_t*)NULL, 
+					  (DRB_ToAddModList_t*)*DRB_configList2,
+					  (DRB_ToReleaseList_t*)NULL,  // DRB2_list,
+                                         (struct SPS_Config*)NULL,    // *sps_Config,
+					  NULL, NULL, NULL, NULL,NULL,
+					  NULL, NULL,  NULL, NULL, NULL, NULL, 
+					  (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList
+#if defined(Rel10) || defined(Rel14)
+                                         , (SCellToAddMod_r10_t*)NULL
+#endif
+                                        );
+ 
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n");
+  for (i = 0; i < size; i++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
+  }
+  LOG_F(RRC,"\n");
+  ////////////////////////////////////////
+#endif
+
+#if defined(ENABLE_ITTI)
+
+  /* Free all NAS PDUs */
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
+    if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
+      /* Free the NAS PDU buffer and invalidate it */
+      free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer);
+      ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL;
+    }
+  }
+#endif
+
+ LOG_I(RRC,
+        "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n",
+        ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
+
+  LOG_D(RRC,
+        "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
+        ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+    ctxt_pP,
+    DCCH,
+    rrc_eNB_mui++,
+    SDU_CONFIRM_NO,
+    size,
+    buffer,
+    PDCP_TRANSMISSION_MODE_CONTROL);
+
+
+}
+int
+rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP,
+                             rrc_eNB_ue_context_t*          const ue_context_pP,
+                             const uint8_t                ho_state
+                             )
+//-----------------------------------------------------------------------------
+{
+  uint8_t                             buffer[RRC_BUF_SIZE];
+  uint16_t                            size;
+  int i, j;
+
+  struct DRB_ToAddMod                *DRB_config                       = NULL;
+  struct RLC_Config                  *DRB_rlc_config                   = NULL;
+  struct PDCP_Config                 *DRB_pdcp_config                  = NULL;
+  struct PDCP_Config__rlc_AM         *PDCP_rlc_AM                      = NULL;
+  struct PDCP_Config__rlc_UM         *PDCP_rlc_UM                      = NULL;
+  struct LogicalChannelConfig        *DRB_lchan_config                 = NULL;
+  struct LogicalChannelConfig__ul_SpecificParameters
+  *DRB_ul_SpecificParameters        = NULL;
+  DRB_ToAddModList_t*                 DRB_configList = ue_context_pP->ue_context.DRB_configList;
+  DRB_ToAddModList_t*                DRB_configList2 = NULL;
+
+  struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
+  DedicatedInfoNAS_t                 *dedicatedInfoNas                 = NULL;
+  /* for no gcc warnings */
+  (void)dedicatedInfoNas;
+
+  uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id);   // Transaction_id,
+  DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2));
+  /* Initialize NAS list */
+  dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
+
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_e_rabs; i++) {
+    // bypass the new and already configured erabs
+    if (ue_context_pP->ue_context.modify_e_rab[i].status >= E_RAB_STATUS_DONE) {
+      ue_context_pP->ue_context.modify_e_rab[i].xid = xid;
+      continue;
+    }
+
+    if (ue_context_pP->ue_context.modify_e_rab[i].cause != S1AP_CAUSE_NOTHING) {
+      // set xid of failure RAB
+      ue_context_pP->ue_context.modify_e_rab[i].xid = xid;
+      ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED;
+      continue;
+    }
+
+    DRB_config = NULL;
+    // search exist DRB_config
+    for (j = 0; j < DRB_configList->list.count; j++) {
+      if((uint8_t)*(DRB_configList->list.array[j]->eps_BearerIdentity) == ue_context_pP->ue_context.modify_e_rab[i].param.e_rab_id) {
+        DRB_config = DRB_configList->list.array[j];
+        break;
+      }
+    }
+    if (NULL == DRB_config) {
+      ue_context_pP->ue_context.modify_e_rab[i].xid = xid;
+      ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED;
+      // TODO use which cause
+      ue_context_pP->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK;
+      ue_context_pP->ue_context.modify_e_rab[i].cause_value = 0;//S1ap_CauseRadioNetwork_unspecified;
+      ue_context_pP->ue_context.nb_of_failed_e_rabs++;
+      continue;
+    }
+
+    DRB_rlc_config = DRB_config->rlc_Config;
+
+    DRB_pdcp_config = DRB_config->pdcp_Config;
+    *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity;
+    switch (ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci) {
+    /*
+     * type: realtime data with medium packer error rate
+     * action: swtich to RLC UM
+     */
+    case 1: // 100ms, 10^-2, p2, GBR
+    case 2: // 150ms, 10^-3, p4, GBR
+    case 3: // 50ms, 10^-3, p3, GBR
+    case 4:  // 300ms, 10^-6, p5
+    case 7: // 100ms, 10^-3, p7, GBR
+    case 9: // 300ms, 10^-6, p9
+    case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR
+    case 66: // 100ms, 10^-2, p2, non-mission critical  voice , GBR
+      // RLC
+      DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional;
+      DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+      DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+      DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35;
+      // PDCP
+      if (DRB_pdcp_config->rlc_AM) {
+        free(DRB_pdcp_config->rlc_AM);
+        DRB_pdcp_config->rlc_AM = NULL;
+      }
+      if (DRB_pdcp_config->rlc_UM) {
+        free(DRB_pdcp_config->rlc_UM);
+        DRB_pdcp_config->rlc_UM = NULL;
+      }
+      PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM));
+      DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
+      PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
+      break;
+
+    /*
+     * type: non-realtime data with low packer error rate
+     * action: swtich to RLC AM
+     */
+    case 5:  // 100ms, 10^-6, p1 , IMS signaling
+    case 6:  // 300ms, 10^-6, p6
+    case 8: // 300ms, 10^-6, p8
+    case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority
+    case 70: // 200ms, 10^-6, p5.5, mision critical data
+       // RLC
+       DRB_rlc_config->present = RLC_Config_PR_am;
+       DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50;
+       DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16;
+       DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity;
+       DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8;
+       DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
+       DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25;
+
+       // PDCP
+       if (DRB_pdcp_config->rlc_AM) {
+         free(DRB_pdcp_config->rlc_AM);
+         DRB_pdcp_config->rlc_AM = NULL;
+       }
+       if (DRB_pdcp_config->rlc_UM) {
+         free(DRB_pdcp_config->rlc_UM);
+         DRB_pdcp_config->rlc_UM = NULL;
+       }
+       PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM));
+       DRB_pdcp_config->rlc_AM = PDCP_rlc_AM;
+       PDCP_rlc_AM->statusReportRequired = FALSE;
+
+       break;
+    default :
+      LOG_E(RRC, "not supported qci %d\n", ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci);
+      ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED;
+      ue_context_pP->ue_context.modify_e_rab[i].xid = xid;
+      ue_context_pP->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK;
+      ue_context_pP->ue_context.modify_e_rab[i].cause_value = 37;//S1ap_CauseRadioNetwork_not_supported_QCI_value;
+      ue_context_pP->ue_context.nb_of_failed_e_rabs++;
+      continue;
+    }
+
+    DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed;
+
+    DRB_lchan_config = DRB_config->logicalChannelConfig;
+    DRB_ul_SpecificParameters = DRB_lchan_config->ul_SpecificParameters;
+
+    if (ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci < 9 )
+      DRB_ul_SpecificParameters->priority = qci_to_priority[ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci-1] + 3;
+    else
+      DRB_ul_SpecificParameters->priority= 4;
+
+    DRB_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8;
+
+    DRB_ul_SpecificParameters->bucketSizeDuration =
+      LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+    ASN_SEQUENCE_ADD(&(DRB_configList2)->list, DRB_config);
+
+    LOG_I(RRC, "EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n",
+      *DRB_config->eps_BearerIdentity,
+      DRB_config->drb_Identity, i,
+      ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci,
+      DRB_ul_SpecificParameters->priority,
+      *(DRB_config->logicalChannelIdentity),
+      *DRB_ul_SpecificParameters->logicalChannelGroup
+      );
+
+    //e_rab_done++;
+    ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_DONE;
+    ue_context_pP->ue_context.modify_e_rab[i].xid = xid;
+
+    {
+      if (ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer != NULL) {
+        dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t));
+        memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t));
+        OCTET_STRING_fromBuf(dedicatedInfoNas,
+                 (char*)ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer,
+                 ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length);
+        ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
+        LOG_I(RRC, "add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length, i);
+      }
+      else {
+        LOG_W(RRC, "Not received activate dedicated EPS bearer context request\n");
+      }
+    }
+  }
+
+  /* If list is empty free the list and reset the address */
+  if (dedicatedInfoNASList != NULL) {
+    if (dedicatedInfoNASList->list.count == 0) {
+      free(dedicatedInfoNASList);
+      dedicatedInfoNASList = NULL;
+      LOG_W(RRC,"dedlicated NAS list is empty, free the list and reset the address\n");
+    }
+  } else {
+    LOG_W(RRC,"dedlicated NAS list is empty\n");
+  }
+
+  memset(buffer, 0, RRC_BUF_SIZE);
+
+  size = do_RRCConnectionReconfiguration(ctxt_pP,
+                                          buffer,
+                                          xid,
+                                          (SRB_ToAddModList_t*)NULL,
+                                          (DRB_ToAddModList_t*)DRB_configList2,
+                                          (DRB_ToReleaseList_t*)NULL,  // DRB2_list,
+                                          (struct SPS_Config*)NULL,    // *sps_Config,
+                                          NULL, NULL, NULL, NULL,NULL,
+                                          NULL, NULL,  NULL, NULL, NULL, NULL,
+                                          (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList
+#if defined(Rel10) || defined(Rel14)
+                                          , (SCellToAddMod_r10_t*)NULL
+#endif
+                                          );
+
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n");
+  for (i = 0; i < size; i++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
+  }
+  LOG_F(RRC,"\n");
+  ////////////////////////////////////////
+#endif
+
+#if defined(ENABLE_ITTI)
+
+  /* Free all NAS PDUs */
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_e_rabs; i++) {
+    if (ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer != NULL) {
+      /* Free the NAS PDU buffer and invalidate it */
+      free(ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer);
+      ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer = NULL;
+    }
+  }
+#endif
+
+ LOG_I(RRC,
+        "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n",
+        ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
+
+  LOG_D(RRC,
+        "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
+        ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+    ctxt_pP,
+    DCCH,
+    rrc_eNB_mui++,
+    SDU_CONFIRM_NO,
+    size,
+    buffer,
+    PDCP_TRANSMISSION_MODE_CONTROL);
+  return 0;
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release(  const protocol_ctxt_t*   const ctxt_pP,
+        rrc_eNB_ue_context_t*    const ue_context_pP,
+        uint8_t                  xid,
+        uint32_t                 nas_length,
+        uint8_t*                 nas_buffer)
+//-----------------------------------------------------------------------------
+{
+    uint8_t                             buffer[RRC_BUF_SIZE];
+    int                                 i;
+    uint16_t                            size  = 0;
+    DRB_ToReleaseList_t**                DRB_Release_configList2=NULL;
+    DRB_Identity_t* DRB_release;
+    struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
+
+    DRB_Release_configList2=&ue_context_pP->ue_context.DRB_Release_configList2[xid];
+    if (*DRB_Release_configList2) {
+      free(*DRB_Release_configList2);
+    }
+    *DRB_Release_configList2 = CALLOC(1, sizeof(**DRB_Release_configList2));
+
+    for(i = 0; i < NB_RB_MAX; i++){
+        if((ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_TORELEASE) && ue_context_pP->ue_context.e_rab[i].xid == xid){
+            DRB_release = CALLOC(1, sizeof(DRB_Identity_t));
+            *DRB_release = i+1;
+            ASN_SEQUENCE_ADD(&(*DRB_Release_configList2)->list, DRB_release);
+            //free(DRB_release);
+        }
+    }
+
+    /* If list is empty free the list and reset the address */
+    if (nas_length > 0) {
+        DedicatedInfoNAS_t                 *dedicatedInfoNas                 = NULL;
+        dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
+        dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t));
+        memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t));
+                       OCTET_STRING_fromBuf(dedicatedInfoNas,
+                              (char*)nas_buffer,
+                              nas_length);
+        ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
+        LOG_I(RRC,"add NAS info with size %d\n",nas_length);
+    } else {
+      LOG_W(RRC,"dedlicated NAS list is empty\n");
+    }
+
+    memset(buffer, 0, RRC_BUF_SIZE);
+    size = do_RRCConnectionReconfiguration(ctxt_pP,
+                                    buffer,
+                                    xid,
+                                    NULL,
+                                    NULL,
+                                    (DRB_ToReleaseList_t*)*DRB_Release_configList2,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    NULL,
+                                    (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList
+#if defined(Rel10) || defined(Rel14)
+                                    , (SCellToAddMod_r10_t*)NULL
+#endif
+                                   );
+    ue_context_pP->ue_context.e_rab_release_command_flag = 1;
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n");
+  for (i = 0; i < size; i++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
+  }
+  LOG_F(RRC,"\n");
+  ////////////////////////////////////////
+#endif
+
+#if defined(ENABLE_ITTI)
+  /* Free all NAS PDUs */
+  if (nas_length > 0) {
+      /* Free the NAS PDU buffer and invalidate it */
+      free(nas_buffer);
+  }
+#endif
+
+  LOG_I(RRC,
+        "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n",
+        ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
+
+  LOG_D(RRC,
+        "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
+        ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+    ctxt_pP,
+    DCCH,
+    rrc_eNB_mui++,
+    SDU_CONFIRM_NO,
+    size,
+    buffer,
+    PDCP_TRANSMISSION_MODE_CONTROL);
+
+}
+#endif 
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP,
+						     rrc_eNB_ue_context_t*          const ue_context_pP,
+						     const uint8_t                ho_state
+						     )
+//-----------------------------------------------------------------------------
+{
+  uint8_t                             buffer[RRC_BUF_SIZE];
+  uint16_t                            size;
+  int                                 i;
+
+  // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE
+  eNB_RRC_INST*                       rrc_inst = RC.rrc[ctxt_pP->module_id];
+  struct PhysicalConfigDedicated**    physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated;
+
+  struct SRB_ToAddMod                *SRB2_config                      = NULL;
+  struct SRB_ToAddMod__rlc_Config    *SRB2_rlc_config                  = NULL;
+  struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config         = NULL;
+  struct LogicalChannelConfig__ul_SpecificParameters
+      *SRB2_ul_SpecificParameters       = NULL;
+  SRB_ToAddModList_t*                 SRB_configList = ue_context_pP->ue_context.SRB_configList;
+  SRB_ToAddModList_t                 **SRB_configList2                  = NULL;
+
+  struct DRB_ToAddMod                *DRB_config                       = NULL;
+  struct RLC_Config                  *DRB_rlc_config                   = NULL;
+  struct PDCP_Config                 *DRB_pdcp_config                  = NULL;
+  struct PDCP_Config__rlc_AM         *PDCP_rlc_AM                      = NULL;
+  struct PDCP_Config__rlc_UM         *PDCP_rlc_UM                      = NULL;
+  struct LogicalChannelConfig        *DRB_lchan_config                 = NULL;
+  struct LogicalChannelConfig__ul_SpecificParameters
+      *DRB_ul_SpecificParameters        = NULL;
+  DRB_ToAddModList_t**                DRB_configList = &ue_context_pP->ue_context.DRB_configList;
+  DRB_ToAddModList_t**                DRB_configList2 = NULL;
+   MAC_MainConfig_t                   *mac_MainConfig                   = NULL;
+  MeasObjectToAddModList_t           *MeasObj_list                     = NULL;
+  MeasObjectToAddMod_t               *MeasObj                          = NULL;
+  ReportConfigToAddModList_t         *ReportConfig_list                = NULL;
+  ReportConfigToAddMod_t             *ReportConfig_per, *ReportConfig_A1,
+                                     *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5;
+  MeasIdToAddModList_t               *MeasId_list                      = NULL;
+  MeasIdToAddMod_t                   *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5;
+#if defined(Rel10) || defined(Rel14)
+  long                               *sr_ProhibitTimer_r9              = NULL;
+  //     uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1);
+  //uint8_t                            sCellIndexToAdd = 0;
+#endif
+
+  long                               *logicalchannelgroup, *logicalchannelgroup_drb;
+  long                               *maxHARQ_Tx, *periodicBSR_Timer;
+
+  RSRP_Range_t                       *rsrp                             = NULL;
+  struct MeasConfig__speedStatePars  *Sparams                          = NULL;
+  QuantityConfig_t                   *quantityConfig                   = NULL;
+  CellsToAddMod_t                    *CellToAdd                        = NULL;
+  CellsToAddModList_t                *CellsToAddModList                = NULL;
+  struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
+  DedicatedInfoNAS_t                 *dedicatedInfoNas                 = NULL;
+  /* for no gcc warnings */
+  (void)dedicatedInfoNas;
+
+  C_RNTI_t                           *cba_RNTI                         = NULL;
+
+  uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id);   //Transaction_id,
+
+#ifdef CBA
+  //struct PUSCH_CBAConfigDedicated_vlola  *pusch_CBAConfigDedicated_vlola;
+  uint8_t                            *cba_RNTI_buf;
+  cba_RNTI = CALLOC(1, sizeof(C_RNTI_t));
+  cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t));
+  cba_RNTI->buf = cba_RNTI_buf;
+  cba_RNTI->size = 2;
+  cba_RNTI->bits_unused = 0;
+
+  // associate UEs to the CBa groups as a function of their UE id
+  if (rrc_inst->num_active_cba_groups) {
+    cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff;
+    cba_RNTI->buf[1] = 0xff;
+    LOG_D(RRC,
+          "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n",
+          enb_mod_idP, frameP,
+          rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups],
+          ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP);
+  } else {
+    cba_RNTI->buf[0] = 0x0;
+    cba_RNTI->buf[1] = 0x0;
+    LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP);
+  }
+
+#endif
+
+  T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  // Configure SRB2
+  /// SRB2
+  SRB_configList2=&ue_context_pP->ue_context.SRB_configList2[xid];
+  if (*SRB_configList2) {
+    free(*SRB_configList2);
+  }
+  *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2));
+  memset(*SRB_configList2, 0, sizeof(**SRB_configList2));
+  SRB2_config = CALLOC(1, sizeof(*SRB2_config));
+
+  SRB2_config->srb_Identity = 2;
+  SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config));
+  SRB2_config->rlc_Config = SRB2_rlc_config;
+
+  SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue;
+  SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32;
+  SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
+  SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10;
+
+  SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config));
+  SRB2_config->logicalChannelConfig = SRB2_lchan_config;
+
+  SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue;
+
+  SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters));
+
+  SRB2_ul_SpecificParameters->priority = 3; // let some priority for SRB1 and dedicated DRBs
+  SRB2_ul_SpecificParameters->prioritisedBitRate =
+    LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+  SRB2_ul_SpecificParameters->bucketSizeDuration =
+    LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+  // LCG for CCCH and DCCH is 0 as defined in 36331
+  logicalchannelgroup = CALLOC(1, sizeof(long));
+  *logicalchannelgroup = 0;
+
+  SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup;
+
+  SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters;
+  // this list has the configuration for SRB1 and SRB2
+  ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
+  // this list has only the configuration for SRB2
+  ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config);
+
+  // Configure DRB
+  //*DRB_configList = CALLOC(1, sizeof(*DRB_configList));
+  // list for all the configured DRB
+  if (*DRB_configList) {
+    free(*DRB_configList);
+  }
+  *DRB_configList = CALLOC(1, sizeof(**DRB_configList));
+  memset(*DRB_configList, 0, sizeof(**DRB_configList));
+
+  // list for the configured DRB for a this xid
+  DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid];
+  if (*DRB_configList2) {
+    free(*DRB_configList2);
+  }
+  *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2));
+  memset(*DRB_configList2, 0, sizeof(**DRB_configList2));
+
+
+  /// DRB
+  DRB_config = CALLOC(1, sizeof(*DRB_config));
+
+  DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long));
+  *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4
+  // DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32
+  // NN: this is the 1st DRB for this ue, so set it to 1
+  DRB_config->drb_Identity = (DRB_Identity_t) 1;  // (ue_mod_idP+1); //allowed values 1..32, value: x
+  DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long));
+  *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2
+  DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config));
+  DRB_config->rlc_Config = DRB_rlc_config;
+
+#ifdef RRC_DEFAULT_RAB_IS_AM
+  DRB_rlc_config->present = RLC_Config_PR_am;
+  DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50;
+  DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16;
+  DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity;
+  DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8;
+  DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
+  DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25;
+#else
+  DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional;
+  DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+  DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+#ifdef CBA
+  DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering   = T_Reordering_ms5;//T_Reordering_ms25;
+#else
+  DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35;
+#endif
+#endif
+
+  DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
+  DRB_config->pdcp_Config = DRB_pdcp_config;
+  DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
+  *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity;
+  DRB_pdcp_config->rlc_AM = NULL;
+  DRB_pdcp_config->rlc_UM = NULL;
+
+  /* avoid gcc warnings */
+  (void)PDCP_rlc_AM;
+  (void)PDCP_rlc_UM;
+
+#ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT
+  PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM));
+  DRB_pdcp_config->rlc_AM = PDCP_rlc_AM;
+  PDCP_rlc_AM->statusReportRequired = FALSE;
+#else
+  PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM));
+  DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
+  PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
+#endif
+  DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed;
+
+  DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config));
+  DRB_config->logicalChannelConfig = DRB_lchan_config;
+  DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
+  DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
+
+  DRB_ul_SpecificParameters->priority = 12;    // lower priority than srb1, srb2 and other dedicated bearer
+  DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ;
+    //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+  DRB_ul_SpecificParameters->bucketSizeDuration =
+    LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+  // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
+  logicalchannelgroup_drb = CALLOC(1, sizeof(long));
+  *logicalchannelgroup_drb = 1;
+  DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
+
+  ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config);
+  ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
+
+  //ue_context_pP->ue_context.DRB_configList2[0] = &(*DRB_configList);
+
+  mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig));
+  ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig;
+
+  mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config));
+
+  maxHARQ_Tx = CALLOC(1, sizeof(long));
+  *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
+  mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx;
+  periodicBSR_Timer = CALLOC(1, sizeof(long));
+  *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64;
+  mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer;
+  mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320;
+  mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE
+
+  mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity;
+
+  mac_MainConfig->drx_Config = NULL;
+
+  mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config));
+
+  mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup;
+  mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes
+
+  mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes
+
+  mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;  // Value dB1 =1 dB, dB3 = 3 dB
+
+#if defined(Rel10) || defined(Rel14)
+  sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long));
+  *sr_ProhibitTimer_r9 = 0;   // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR
+  mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1));
+  mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9;
+  //sps_RA_ConfigList_rlola = NULL;
+#endif
+
+  //change the transmission mode for the primary component carrier
+  //TODO: add codebook subset restriction here
+  //TODO: change TM for secondary CC in SCelltoaddmodlist
+  if (*physicalConfigDedicated) {
+    if ((*physicalConfigDedicated)->antennaInfo) {
+      (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0];
+      LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]);
+      if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm3) {
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     
+	  CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+	  AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
+      }
+      else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) {
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     
+	  CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+	  AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1);
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2;
+
+      }
+      else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) {
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     
+	  CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+	  AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1);
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4;
+      }
+      else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6) {
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     
+	  CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+	  AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1);
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1;
+	(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4;
+      }
+    }
+    else {
+      LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n");
+    }
+    if ((*physicalConfigDedicated)->cqi_ReportConfig) {
+      if ((rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) ||
+	  (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) ||
+	  (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) {
+	//feedback mode needs to be set as well
+	//TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable
+	printf("setting cqi reporting mode to rm31\n");
+#if defined(Rel10) || defined(Rel14)
+	*((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31;
+#else
+	*((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI
+#endif
+      }
+    }
+    else {
+      LOG_E(RRC,"cqi_ReportConfig not present in physical_config_dedicated. Not reconfiguring!\n");
+    }
+  }
+  else {
+    LOG_E(RRC,"physical_config_dedicated not present in RRCConnectionReconfiguration. Not reconfiguring!\n");
+  }
+
+  // Measurement ID list
+  MeasId_list = CALLOC(1, sizeof(*MeasId_list));
+  memset((void *)MeasId_list, 0, sizeof(*MeasId_list));
+
+  MeasId0 = CALLOC(1, sizeof(*MeasId0));
+  MeasId0->measId = 1;
+  MeasId0->measObjectId = 1;
+  MeasId0->reportConfigId = 1;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0);
+
+  MeasId1 = CALLOC(1, sizeof(*MeasId1));
+  MeasId1->measId = 2;
+  MeasId1->measObjectId = 1;
+  MeasId1->reportConfigId = 2;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1);
+
+  MeasId2 = CALLOC(1, sizeof(*MeasId2));
+  MeasId2->measId = 3;
+  MeasId2->measObjectId = 1;
+  MeasId2->reportConfigId = 3;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2);
+
+  MeasId3 = CALLOC(1, sizeof(*MeasId3));
+  MeasId3->measId = 4;
+  MeasId3->measObjectId = 1;
+  MeasId3->reportConfigId = 4;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3);
+
+  MeasId4 = CALLOC(1, sizeof(*MeasId4));
+  MeasId4->measId = 5;
+  MeasId4->measObjectId = 1;
+  MeasId4->reportConfigId = 5;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4);
+
+  MeasId5 = CALLOC(1, sizeof(*MeasId5));
+  MeasId5->measId = 6;
+  MeasId5->measObjectId = 1;
+  MeasId5->reportConfigId = 6;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5);
+
+  //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list;
+
+  // Add one EUTRA Measurement Object
+  MeasObj_list = CALLOC(1, sizeof(*MeasObj_list));
+  memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list));
+
+  // Configure MeasObject
+
+  MeasObj = CALLOC(1, sizeof(*MeasObj));
+  memset((void *)MeasObj, 0, sizeof(*MeasObj));
+
+  MeasObj->measObjectId = 1;
+  MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA;
+  MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz
+  //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz
+  MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25;
+  MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t));
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6;
+  MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL;   // Default is 15 or 0dB
+
+  MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList =
+    (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList));
+
+  CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList;
+
+  // Add adjacent cell lists (6 per eNB)
+  for (i = 0; i < 6; i++) {
+    CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd));
+    CellToAdd->cellIndex = i + 1;
+    CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i);
+    CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0;
+
+    ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd);
+  }
+
+  ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj);
+  //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
+
+  // Report Configurations for periodical, A1-A5 events
+  ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list));
+
+  ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per));
+
+  ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1));
+
+  ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2));
+
+  ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3));
+
+  ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4));
+
+  ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5));
+
+  ReportConfig_per->reportConfigId = 1;
+  ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_periodical;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose =
+    ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per);
+
+  ReportConfig_A1->reportConfigId = 2;
+  ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_event;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+    ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
+  a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
+  a1_Threshold.choice.threshold_RSRP = 10;
+
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1);
+  
+  if (ho_state == 1 /*HO_MEASURMENT */ ) {
+    LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n",
+          ctxt_pP->module_id, ctxt_pP->frame);
+    ReportConfig_A2->reportConfigId = 3;
+    ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA2.a2_Threshold.choice.threshold_RSRP = 10;
+
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2);
+
+    ReportConfig_A3->reportConfigId = 4;
+    ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3;
+
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1;   //10;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA3.reportOnLeave = 1;
+
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long!
+    ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger =
+      TimeToTrigger_ms40;
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3);
+
+    ReportConfig_A4->reportConfigId = 5;
+    ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA4.a4_Threshold.choice.threshold_RSRP = 10;
+
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4);
+
+    ReportConfig_A5->reportConfigId = 6;
+    ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_event;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+      ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold1.choice.threshold_RSRP = 10;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+    eventA5.a5_Threshold2.choice.threshold_RSRP = 10;
+
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity =
+      ReportConfigEUTRA__triggerQuantity_rsrp;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+    ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+    ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5);
+    //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list;
+
+    rsrp = CALLOC(1, sizeof(RSRP_Range_t));
+    *rsrp = 20;
+
+    Sparams = CALLOC(1, sizeof(*Sparams));
+    Sparams->present = MeasConfig__speedStatePars_PR_setup;
+    Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75;
+    Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5;
+    Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10;
+    Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5;
+    Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60;
+    Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120;
+
+    quantityConfig = CALLOC(1, sizeof(*quantityConfig));
+    memset((void *)quantityConfig, 0, sizeof(*quantityConfig));
+    quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA));
+    memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA));
+    quantityConfig->quantityConfigCDMA2000 = NULL;
+    quantityConfig->quantityConfigGERAN = NULL;
+    quantityConfig->quantityConfigUTRA = NULL;
+    quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP =
+      CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP)));
+    quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ =
+      CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)));
+    *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4;
+    *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4;
+
+    LOG_I(RRC,
+          "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n",
+          ctxt_pP->module_id, ctxt_pP->frame);
+    // store the information in an intermediate structure for Hanodver management
+    //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof());
+    ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info)));
+    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = *SRB_configList2;
+    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = *DRB_configList;
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL;
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig =
+      CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig));
+    memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig,
+           (void *)mac_MainConfig, sizeof(MAC_MainConfig_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated =
+      CALLOC(1, sizeof(PhysicalConfigDedicated_t));
+    memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated,
+           (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t));
+    ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL;
+    //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t));
+
+  }
+
+#if defined(ENABLE_ITTI)
+  /* Initialize NAS list */
+  dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
+
+  /* Add all NAS PDUs to the list */
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
+    if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
+      dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t));
+      memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t));
+      OCTET_STRING_fromBuf(dedicatedInfoNas, 
+			   (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer,
+                           ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length);
+      ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
+    }
+
+    /* TODO parameters yet to process ... */
+    {
+      //      ue_context_pP->ue_context.e_rab[i].param.qos;
+      //      ue_context_pP->ue_context.e_rab[i].param.sgw_addr;
+      //      ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
+    }
+
+    /* TODO should test if e RAB are Ok before! */
+    ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE;
+    LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", 
+	  i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE");
+  }
+
+  /* If list is empty free the list and reset the address */
+  if (dedicatedInfoNASList->list.count == 0) {
+    free(dedicatedInfoNASList);
+    dedicatedInfoNASList = NULL;
+  }
+
+#endif
+
+  memset(buffer, 0, RRC_BUF_SIZE);
+
+  size = do_RRCConnectionReconfiguration(ctxt_pP,
+                                         buffer,
+                                         xid,   //Transaction_id,
+                                         (SRB_ToAddModList_t*)*SRB_configList2, // SRB_configList
+                                         (DRB_ToAddModList_t*)*DRB_configList,
+                                         (DRB_ToReleaseList_t*)NULL,  // DRB2_list,
+                                         (struct SPS_Config*)NULL,    // *sps_Config,
+                                         (struct PhysicalConfigDedicated*)*physicalConfigDedicated,
+#ifdef EXMIMO_IOT
+                                         NULL, NULL, NULL,NULL,
+#else
+                                         (MeasObjectToAddModList_t*)MeasObj_list,
+                                         (ReportConfigToAddModList_t*)ReportConfig_list,
+                                         (QuantityConfig_t*)quantityConfig,
+                                         (MeasIdToAddModList_t*)MeasId_list,
+#endif
+                                         (MAC_MainConfig_t*)mac_MainConfig,
+                                         (MeasGapConfig_t*)NULL,
+                                         (MobilityControlInfo_t*)NULL,
+                                         (struct MeasConfig__speedStatePars*)Sparams,
+                                         (RSRP_Range_t*)rsrp,
+                                         (C_RNTI_t*)cba_RNTI,
+                                         (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList
+#if defined(Rel10) || defined(Rel14)
+                                         , (SCellToAddMod_r10_t*)NULL
+#endif
+                                        );
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n");
+  for (i = 0; i < size; i++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
+  }
+  LOG_F(RRC,"\n");
+  ////////////////////////////////////////
+#endif
+
+#if defined(ENABLE_ITTI)
+
+  /* Free all NAS PDUs */
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
+    if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
+      /* Free the NAS PDU buffer and invalidate it */
+      free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer);
+      ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL;
+    }
+  }
+
+#endif
+
+  LOG_I(RRC,
+        "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n",
+        ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
+
+  LOG_D(RRC,
+        "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
+        ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+	       ctxt_pP,
+	       DCCH,
+	       rrc_eNB_mui++,
+	       SDU_CONFIRM_NO,
+	       size,
+	       buffer,
+	       PDCP_TRANSMISSION_MODE_CONTROL);
+}
+
+//-----------------------------------------------------------------------------
+void
+flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP,
+                 rrc_eNB_ue_context_t*          const ue_context_pP,
+                 const uint8_t                ho_state,
+                 agent_reconf_rrc * trig_param
+                 )
+//-----------------------------------------------------------------------------
+{
+  uint8_t                             buffer[RRC_BUF_SIZE];
+  uint16_t                            size;
+  int                                 i;
+ 
+  // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE
+  eNB_RRC_INST*                       rrc_inst = RC.rrc[ctxt_pP->module_id];
+  struct PhysicalConfigDedicated**    physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated;
+
+  struct SRB_ToAddMod                *SRB2_config                      = NULL;
+  struct SRB_ToAddMod__rlc_Config    *SRB2_rlc_config                  = NULL;
+  struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config         = NULL;
+  struct LogicalChannelConfig__ul_SpecificParameters
+      *SRB2_ul_SpecificParameters       = NULL;
+  SRB_ToAddModList_t*                 SRB_configList = ue_context_pP->ue_context.SRB_configList;
+  SRB_ToAddModList_t                 **SRB_configList2                  = NULL;
+
+  struct DRB_ToAddMod                *DRB_config                       = NULL;
+  struct RLC_Config                  *DRB_rlc_config                   = NULL;
+  struct PDCP_Config                 *DRB_pdcp_config                  = NULL;
+  struct PDCP_Config__rlc_AM         *PDCP_rlc_AM                      = NULL;
+  struct PDCP_Config__rlc_UM         *PDCP_rlc_UM                      = NULL;
+  struct LogicalChannelConfig        *DRB_lchan_config                 = NULL;
+  struct LogicalChannelConfig__ul_SpecificParameters
+      *DRB_ul_SpecificParameters        = NULL;
+  DRB_ToAddModList_t**                DRB_configList = &ue_context_pP->ue_context.DRB_configList;
+  DRB_ToAddModList_t**                DRB_configList2 = NULL;
+   MAC_MainConfig_t                   *mac_MainConfig                   = NULL;
+  MeasObjectToAddModList_t           *MeasObj_list                     = NULL;
+  MeasObjectToAddMod_t               *MeasObj                          = NULL;
+  ReportConfigToAddModList_t         *ReportConfig_list                = NULL;
+  ReportConfigToAddMod_t             *ReportConfig_per;//, *ReportConfig_A1,
+                                     // *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5;
+  MeasIdToAddModList_t               *MeasId_list                      = NULL;
+  MeasIdToAddMod_t                   *MeasId0; //, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5;
+#if Rel10
+  long                               *sr_ProhibitTimer_r9              = NULL;
+  //     uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1);
+  //uint8_t                            sCellIndexToAdd = 0;
+#endif
+
+  long                               *logicalchannelgroup, *logicalchannelgroup_drb;
+  long                               *maxHARQ_Tx, *periodicBSR_Timer;
+
+  RSRP_Range_t                       *rsrp                             = NULL;
+  struct MeasConfig__speedStatePars  *Sparams                          = NULL;
+  QuantityConfig_t                   *quantityConfig                   = NULL;
+  CellsToAddMod_t                    *CellToAdd                        = NULL;
+  CellsToAddModList_t                *CellsToAddModList                = NULL;
+  struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
+  DedicatedInfoNAS_t                 *dedicatedInfoNas                 = NULL;
+  /* for no gcc warnings */
+  (void)dedicatedInfoNas;
+
+  C_RNTI_t                           *cba_RNTI                         = NULL;
+
+  uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id);   //Transaction_id,
+
+#ifdef CBA
+  //struct PUSCH_CBAConfigDedicated_vlola  *pusch_CBAConfigDedicated_vlola;
+  uint8_t                            *cba_RNTI_buf;
+  cba_RNTI = CALLOC(1, sizeof(C_RNTI_t));
+  cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t));
+  cba_RNTI->buf = cba_RNTI_buf;
+  cba_RNTI->size = 2;
+  cba_RNTI->bits_unused = 0;
+
+  // associate UEs to the CBa groups as a function of their UE id
+  if (rrc_inst->num_active_cba_groups) {
+    cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff;
+    cba_RNTI->buf[1] = 0xff;
+    LOG_D(RRC,
+          "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n",
+          enb_mod_idP, frameP,
+          rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups],
+          ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP);
+  } else {
+    cba_RNTI->buf[0] = 0x0;
+    cba_RNTI->buf[1] = 0x0;
+    LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP);
+  }
+
+#endif
+
+  T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  // Configure SRB2
+  /// SRB2
+  SRB_configList2=&ue_context_pP->ue_context.SRB_configList2[xid];
+  if (*SRB_configList2) {
+    free(*SRB_configList2);
+  }
+  *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2));
+  memset(*SRB_configList2, 0, sizeof(**SRB_configList2));
+  SRB2_config = CALLOC(1, sizeof(*SRB2_config));
+
+  SRB2_config->srb_Identity = 2;
+  SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config));
+  SRB2_config->rlc_Config = SRB2_rlc_config;
+
+  SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue;
+  SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32;
+  SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
+  SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10;
+
+  SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config));
+  SRB2_config->logicalChannelConfig = SRB2_lchan_config;
+
+  SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue;
+
+  SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters));
+
+  SRB2_ul_SpecificParameters->priority = 3; // let some priority for SRB1 and dedicated DRBs
+  SRB2_ul_SpecificParameters->prioritisedBitRate =
+    LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+  SRB2_ul_SpecificParameters->bucketSizeDuration =
+    LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+  // LCG for CCCH and DCCH is 0 as defined in 36331
+  logicalchannelgroup = CALLOC(1, sizeof(long));
+  *logicalchannelgroup = 0;
+
+  SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup;
+
+  SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters;
+  // this list has the configuration for SRB1 and SRB2
+  ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
+  // this list has only the configuration for SRB2
+  ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config);
+
+  // Configure DRB
+  //*DRB_configList = CALLOC(1, sizeof(*DRB_configList));
+  // list for all the configured DRB
+  if (*DRB_configList) {
+    free(*DRB_configList);
+  }
+  *DRB_configList = CALLOC(1, sizeof(**DRB_configList));
+  memset(*DRB_configList, 0, sizeof(**DRB_configList));
+
+  // list for the configured DRB for a this xid
+  DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid];
+  if (*DRB_configList2) {
+    free(*DRB_configList2);
+  }
+  *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2));
+  memset(*DRB_configList2, 0, sizeof(**DRB_configList2));
+
+
+  /// DRB
+  DRB_config = CALLOC(1, sizeof(*DRB_config));
+
+  DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long));
+  *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4
+  // DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32
+  // NN: this is the 1st DRB for this ue, so set it to 1
+  DRB_config->drb_Identity = (DRB_Identity_t) 1;  // (ue_mod_idP+1); //allowed values 1..32, value: x
+  DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long));
+  *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2
+  DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config));
+  DRB_config->rlc_Config = DRB_rlc_config;
+
+#ifdef RRC_DEFAULT_RAB_IS_AM
+  DRB_rlc_config->present = RLC_Config_PR_am;
+  DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50;
+  DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16;
+  DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity;
+  DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8;
+  DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
+  DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25;
+#else
+  DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional;
+  DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+  DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+#ifdef CBA
+  DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering   = T_Reordering_ms5;//T_Reordering_ms25;
+#else
+  DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35;
+#endif
+#endif
+
+  DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
+  DRB_config->pdcp_Config = DRB_pdcp_config;
+  DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
+  *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity;
+  DRB_pdcp_config->rlc_AM = NULL;
+  DRB_pdcp_config->rlc_UM = NULL;
+
+  /* avoid gcc warnings */
+  (void)PDCP_rlc_AM;
+  (void)PDCP_rlc_UM;
+
+#ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT
+  PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM));
+  DRB_pdcp_config->rlc_AM = PDCP_rlc_AM;
+  PDCP_rlc_AM->statusReportRequired = FALSE;
+#else
+  PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM));
+  DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
+  PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
+#endif
+  DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed;
+
+  DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config));
+  DRB_config->logicalChannelConfig = DRB_lchan_config;
+  DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
+  DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
+
+  DRB_ul_SpecificParameters->priority = 12;    // lower priority than srb1, srb2 and other dedicated bearer
+  DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ;
+    //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+  DRB_ul_SpecificParameters->bucketSizeDuration =
+    LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+  // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
+  logicalchannelgroup_drb = CALLOC(1, sizeof(long));
+  *logicalchannelgroup_drb = 1;
+  DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
+
+  ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config);
+  ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
+
+  //ue_context_pP->ue_context.DRB_configList2[0] = &(*DRB_configList);
+
+  mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig));
+  // ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig;
+
+  mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config));
+
+  maxHARQ_Tx = CALLOC(1, sizeof(long));
+  *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
+  mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx;
+  periodicBSR_Timer = CALLOC(1, sizeof(long));
+  *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64;
+  mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer;
+  mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320;
+  mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE
+
+  mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity;
+
+  mac_MainConfig->drx_Config = NULL;
+
+  mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config));
+
+  mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup;
+  mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes
+
+  mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes
+
+  mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;  // Value dB1 =1 dB, dB3 = 3 dB
+
+#ifdef Rel10
+  sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long));
+  *sr_ProhibitTimer_r9 = 0;   // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR
+  mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1));
+  mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9;
+  //sps_RA_ConfigList_rlola = NULL;
+#endif
+
+  //change the transmission mode for the primary component carrier
+  //TODO: add codebook subset restriction here
+  //TODO: change TM for secondary CC in SCelltoaddmodlist
+  if (*physicalConfigDedicated) {
+    if ((*physicalConfigDedicated)->antennaInfo) {
+      (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0];
+      LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]);
+      if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm3) {
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     
+    CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+    AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
+      }
+      else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) {
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     
+    CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+    AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4;
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1);
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc;
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1;
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2;
+
+      }
+      else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) {
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     
+    CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+    AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5;
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1);
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0;
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1;
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4;
+      }
+      else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6) {
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=     
+    CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+    AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6;
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1);
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0;
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1;
+  (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4;
+      }
+    }
+    else {
+      LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n");
+    }
+    if ((*physicalConfigDedicated)->cqi_ReportConfig) {
+      if ((rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) ||
+    (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) ||
+    (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) {
+  //feedback mode needs to be set as well
+  //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable
+  printf("setting cqi reporting mode to rm31\n");
+#if defined(Rel10) || defined(Rel14)
+  *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31;
+#else
+  *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI
+#endif
+      }
+    }
+    else {
+      LOG_E(RRC,"cqi_ReportConfig not present in physical_config_dedicated. Not reconfiguring!\n");
+    }
+  }
+  else {
+    LOG_E(RRC,"physical_config_dedicated not present in RRCConnectionReconfiguration. Not reconfiguring!\n");
+  }
+
+  // Measurement ID list
+  MeasId_list = CALLOC(1, sizeof(*MeasId_list));
+  memset((void *)MeasId_list, 0, sizeof(*MeasId_list));
+
+  MeasId0 = CALLOC(1, sizeof(*MeasId0));
+  MeasId0->measId = 1;
+  MeasId0->measObjectId = 1;
+  MeasId0->reportConfigId = 1;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0);
+
+  /*
+   * Add one EUTRA Measurement Object
+  */
+
+  MeasObj_list = CALLOC(1, sizeof(*MeasObj_list));
+  memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list));
+
+  // Configure MeasObject 
+
+  MeasObj = CALLOC(1, sizeof(*MeasObj));
+  memset((void *)MeasObj, 0, sizeof(*MeasObj));
+
+  MeasObj->measObjectId = 1;
+  MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA;
+  MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz
+  //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz
+  MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25;
+  MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t));
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6;
+  MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL;   // Default is 15 or 0dB
+
+  MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList =
+    (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList));
+
+  CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList;
+
+  // Add adjacent cell lists (6 per eNB)
+  for (i = 0; i < 6; i++) {
+    CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd));
+    CellToAdd->cellIndex = i + 1;
+    CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i);
+    CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0;
+
+    ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd);
+  }
+
+  ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj);
+  //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
+
+  // Report Configurations for periodical, A1-A5 events
+
+  /* RRC Strategy Measurement */
+
+
+  if (strcmp("one_shot", trig_param->trigger_policy) == 0){
+
+      trig_param->report_interval = 0;
+      trig_param->report_amount = 0;
+
+  }
+
+  else if (strcmp("event_driven", trig_param->trigger_policy) == 0){
+
+      trig_param->report_interval = 6;
+      trig_param->report_amount = 2;
+
+  }
+
+  else if (strcmp("periodical", trig_param->trigger_policy) == 0){
+
+      trig_param->report_interval = 1;
+      trig_param->report_amount = 7;
+
+  }
+
+  else {
+
+     LOG_E(FLEXRAN_AGENT, "There is something wrong on RRC agent!");
+  }
+
+
+
+  ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list));
+
+  ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per));
+
+    // Periodical Measurement Report
+
+  ReportConfig_per->reportConfigId = 1;
+  ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+
+    ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+      ReportConfigEUTRA__triggerType_PR_periodical;
+
+    ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose =
+      ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells;
+
+    // ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = TimeToTrigger_ms40;  
+    ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+   ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+   ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+   ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = trig_param->report_interval ;//ReportInterval_ms2048; // RRC counter frame- ms1024 is 1ms   
+
+   ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = trig_param->report_amount; //ReportConfigEUTRA__reportAmount_r2; // put r1 to see once, r2 for 2 times and ...
+
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per);
+
+
+
+    quantityConfig = CALLOC(1, sizeof(*quantityConfig));
+    memset((void *)quantityConfig, 0, sizeof(*quantityConfig));
+    quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA));
+    memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA));
+    quantityConfig->quantityConfigCDMA2000 = NULL;
+    quantityConfig->quantityConfigGERAN = NULL;
+    quantityConfig->quantityConfigUTRA = NULL;
+    quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP =
+      CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP)));
+    quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ =
+      CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)));
+    *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4;
+    *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4;
+
+  
+#if defined(ENABLE_ITTI)
+  /* Initialize NAS list */
+  dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
+
+  /* Add all NAS PDUs to the list */
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
+    if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
+      dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t));
+      memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t));
+      OCTET_STRING_fromBuf(dedicatedInfoNas, 
+         (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer,
+                           ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length);
+      ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
+    }
+
+    /* TODO parameters yet to process ... */
+    // {
+      //      ue_context_pP->ue_context.e_rab[i].param.qos;
+      //      ue_context_pP->ue_context.e_rab[i].param.sgw_addr;
+      //      ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
+    // }
+
+    /* TODO should test if e RAB are Ok before! */
+    ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE;
+    LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", 
+    i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE");
+  }
+
+  /* If list is empty free the list and reset the address */
+  if (dedicatedInfoNASList->list.count == 0) {
+    free(dedicatedInfoNASList);
+    dedicatedInfoNASList = NULL;
+  }
+
+#endif
+
+  memset(buffer, 0, RRC_BUF_SIZE);
+  
+  size = do_RRCConnectionReconfiguration(ctxt_pP,
+                                         buffer,
+                                         xid,   //Transaction_id,
+                                         (SRB_ToAddModList_t*)NULL, // SRB_configList
+                                         (DRB_ToAddModList_t*)NULL,
+                                         (DRB_ToReleaseList_t*)NULL,  // DRB2_list,
+                                         (struct SPS_Config*)NULL,    // *sps_Config,
+                                         (struct PhysicalConfigDedicated*)*physicalConfigDedicated,
+// #ifdef EXMIMO_IOT
+//                                          NULL, NULL, NULL,NULL,
+// #else
+                                         (MeasObjectToAddModList_t*)MeasObj_list,
+                                         (ReportConfigToAddModList_t*)ReportConfig_list,
+                                         (QuantityConfig_t*)quantityConfig,
+                                         (MeasIdToAddModList_t*)MeasId_list,
+// #endif
+                                         (MAC_MainConfig_t*)mac_MainConfig,
+                                         (MeasGapConfig_t*)NULL,
+                                         (MobilityControlInfo_t*)NULL,
+                                         (struct MeasConfig__speedStatePars*)Sparams,
+                                         (RSRP_Range_t*)rsrp,
+                                         (C_RNTI_t*)cba_RNTI,
+                                         (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList
+#if defined(Rel10) || defined(Rel14)
+                                         , (SCellToAddMod_r10_t*)NULL
+#endif
+                                        );
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n");
+  for (i = 0; i < size; i++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
+  }
+  LOG_F(RRC,"\n");
+  ////////////////////////////////////////
+#endif
+
+#if defined(ENABLE_ITTI)
+
+  /* Free all NAS PDUs */
+  for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
+    if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
+      /* Free the NAS PDU buffer and invalidate it */
+      free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer);
+      ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL;
+    }
+  }
+
+#endif
+
+  LOG_I(RRC,
+        "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n",
+        ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
+
+  LOG_D(RRC,
+        "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
+        ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+         ctxt_pP,
+         DCCH,
+         rrc_eNB_mui++,
+         SDU_CONFIRM_NO,
+         size,
+         buffer,
+         PDCP_TRANSMISSION_MODE_CONTROL);
+}
+
+
+//-----------------------------------------------------------------------------
+int
+rrc_eNB_generate_RRCConnectionReconfiguration_SCell(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t* const ue_context_pP,
+  uint32_t dl_CarrierFreq_r10
+)
+//-----------------------------------------------------------------------------
+{
+
+  uint8_t size;
+  uint8_t buffer[100];
+
+#if defined(Rel10) || defined(Rel14)
+  uint8_t sCellIndexToAdd = 0; //one SCell so far
+
+  //   uint8_t sCellIndexToAdd;
+  //   sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1);
+  //  if (RC.rrc[enb_mod_idP]->sCell_config[ue_mod_idP][sCellIndexToAdd] ) {
+  if (ue_context_pP->ue_context.sCell_config != NULL) {
+    ue_context_pP->ue_context.sCell_config[sCellIndexToAdd].cellIdentification_r10->dl_CarrierFreq_r10 = dl_CarrierFreq_r10;
+  } else {
+    LOG_E(RRC,"Scell not configured!\n");
+    return(-1);
+  }
+
+#endif
+  size = do_RRCConnectionReconfiguration(ctxt_pP,
+                                         buffer,
+                                         rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),//Transaction_id,
+                                         (SRB_ToAddModList_t*)NULL,
+                                         (DRB_ToAddModList_t*)NULL,
+                                         (DRB_ToReleaseList_t*)NULL,
+                                         (struct SPS_Config*)NULL,
+                                         (struct PhysicalConfigDedicated*)NULL,
+                                         (MeasObjectToAddModList_t*)NULL,
+                                         (ReportConfigToAddModList_t*)NULL,
+                                         (QuantityConfig_t*)NULL,
+                                         (MeasIdToAddModList_t*)NULL,
+                                         (MAC_MainConfig_t*)NULL,
+                                         (MeasGapConfig_t*)NULL,
+                                         (MobilityControlInfo_t*)NULL,
+                                         (struct MeasConfig__speedStatePars*)NULL,
+                                         (RSRP_Range_t*)NULL,
+                                         (C_RNTI_t*)NULL,
+                                         (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)NULL
+
+#if defined(Rel10) || defined(Rel14)
+                                         , ue_context_pP->ue_context.sCell_config
+#endif
+                                        );
+  LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n",
+        ctxt_pP->module_id,ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    buffer,
+    size,
+    MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    rrc_eNB_mui,
+    size);
+
+  rrc_data_req(
+	       ctxt_pP,
+	       DCCH,
+	       rrc_eNB_mui++,
+	       SDU_CONFIRM_NO,
+	       size,
+	       buffer,
+	       PDCP_TRANSMISSION_MODE_CONTROL);
+  return(0);
+}
+
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_process_MeasurementReport(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*         ue_context_pP,
+  const MeasResults_t*   const measResults2
+)
+//-----------------------------------------------------------------------------
+{
+  int i=0;
+  int neighboring_cells=-1;
+  
+  T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  if (measResults2 == NULL )
+    return;
+  
+  if (measResults2->measId > 0 ){
+     if (ue_context_pP->ue_context.measResults == NULL) {
+       ue_context_pP->ue_context.measResults = CALLOC(1, sizeof(MeasResults_t));
+     }
+     ue_context_pP->ue_context.measResults->measId=measResults2->measId; 
+     ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult=measResults2->measResultPCell.rsrpResult;
+     ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult=measResults2->measResultPCell.rsrqResult;
+     LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRP of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult-140);
+     LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRQ of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult/2 - 20);
+   }
+   if (measResults2->measResultNeighCells == NULL)
+     return;
+
+   if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) {
+     neighboring_cells = measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count;
+     
+     if (ue_context_pP->ue_context.measResults->measResultNeighCells == NULL) {
+       
+       ue_context_pP->ue_context.measResults->measResultNeighCells = CALLOC(1, sizeof(*measResults2->measResultNeighCells)*neighboring_cells);
+     }
+     ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count = neighboring_cells;
+     for (i=0; i < neighboring_cells; i++){
+       memcpy (ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i],
+	       measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[i],
+	       sizeof(MeasResultListEUTRA_t));
+       
+       LOG_D(RRC, "Physical Cell Id %d\n",
+	     (int)ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->physCellId);
+       LOG_D(RRC, "RSRP of Target %d\n",
+	     (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult));
+       LOG_D(RRC, "RSRQ of Target %d\n",
+	     (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrqResult));
+     }
+   }
+
+// #if defined(Rel10) || defined(Rel14)
+
+  
+// #else
+  // LOG_I(RRC, "RSRP of Source %d\n", measResults2->measResultServCell.rsrpResult);
+  // LOG_I(RRC, "RSRQ of Source %d\n", measResults2->measResultServCell.rsrqResult);
+// #endif
+
+  // if (ue_context_pP->ue_context.handover_info->ho_prepare != 0xF0) {
+  //   rrc_eNB_generate_HandoverPreparationInformation(ctxt_pP,
+  //       ue_context_pP,
+  //       measResults2->measResultNeighCells->choice.
+  //       measResultListEUTRA.list.array[0]->physCellId);
+  // } else {
+  //   LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame,
+  //         ctxt_pP->rnti);
+  // }
+
+  //Look for IP address of the target eNB
+  //Send Handover Request -> target eNB
+  //Wait for Handover Acknowledgement <- target eNB
+  //Send Handover Command
+
+  //x2delay();
+  //    handover_request_x2(ue_mod_idP,enb_mod_idP,measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId);
+
+  //    uint8_t buffer[100];
+  //    int size=rrc_eNB_generate_Handover_Command_TeNB(0,0,buffer);
+  //
+  //      send_check_message((char*)buffer,size);
+  //send_handover_command();
+
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_HandoverPreparationInformation(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t* const ue_context_pP,
+  PhysCellId_t                 targetPhyId
+)
+//-----------------------------------------------------------------------------
+{
+  struct rrc_eNB_ue_context_s*        ue_context_target_p = NULL;
+  //uint8_t                             UE_id_target        = -1;
+  uint8_t                             mod_id_target = get_adjacent_cell_mod_id(targetPhyId);
+  HANDOVER_INFO                      *handoverInfo = CALLOC(1, sizeof(*handoverInfo));
+  /*
+     uint8_t buffer[100];
+     uint8_t size;
+     struct PhysicalConfigDedicated  **physicalConfigDedicated = &RC.rrc[enb_mod_idP]->physicalConfigDedicated[ue_mod_idP];
+     RadioResourceConfigDedicated_t *radioResourceConfigDedicated = CALLOC(1,sizeof(RadioResourceConfigDedicated_t));
+   */
+
+  T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  handoverInfo->as_config.antennaInfoCommon.antennaPortsCount = 0;    //Not used 0- but check value
+  handoverInfo->as_config.sourceDl_CarrierFreq = 36090;   //Verify!
+
+  memcpy((void *)&handoverInfo->as_config.sourceMasterInformationBlock,
+         (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.mib, sizeof(MasterInformationBlock_t));
+  memcpy((void *)&handoverInfo->as_config.sourceMeasConfig,
+         (void*)ue_context_pP->ue_context.measConfig, sizeof(MeasConfig_t));
+
+  // FIXME handoverInfo not used...
+  free( handoverInfo );
+  handoverInfo = 0;
+
+  //to be configured
+  memset((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSecurityAlgorithmConfig,
+         0, sizeof(SecurityAlgorithmConfig_t));
+
+  memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType1,
+         (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB1, sizeof(SystemInformationBlockType1_t));
+  memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType2,
+         (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB23, sizeof(SystemInformationBlockType2_t));
+  ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo =
+    CALLOC(1, sizeof(ReestablishmentInfo_t));
+  ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->sourcePhysCellId =
+    RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.physCellId;
+  ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.buf = NULL;  // Check values later
+  ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.size = 0;
+  ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.bits_unused = 0;
+  ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->additionalReestabInfoList = NULL;
+  ue_context_pP->ue_context.handover_info->ho_prepare = 0xFF;    //0xF0;
+  ue_context_pP->ue_context.handover_info->ho_complete = 0;
+
+  if (mod_id_target != 0xFF) {
+    //UE_id_target = rrc_find_free_ue_index(modid_target);
+    ue_context_target_p =
+      rrc_eNB_get_ue_context(
+        RC.rrc[mod_id_target],
+        ue_context_pP->ue_context.rnti);
+
+    /*UE_id_target = rrc_eNB_get_next_free_UE_index(
+                    mod_id_target,
+                    RC.rrc[ctxt_pP->module_id]->Info.UE_list[ue_mod_idP]);  //this should return a new index*/
+
+    if (ue_context_target_p == NULL) { // if not already in target cell
+      ue_context_target_p = rrc_eNB_allocate_new_UE_context(RC.rrc[ctxt_pP->module_id]);
+      ue_context_target_p->ue_id_rnti      = ue_context_pP->ue_context.rnti;             // LG: should not be the same
+      ue_context_target_p->ue_context.rnti = ue_context_target_p->ue_id_rnti; // idem
+      LOG_N(RRC,
+            "[eNB %d] Frame %d : Emulate sending HandoverPreparationInformation msg from eNB source %d to eNB target %ld: source UE_id %x target UE_id %x source_modId: %d target_modId: %d\n",
+            ctxt_pP->module_id,
+            ctxt_pP->frame,
+            RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.physCellId,
+            targetPhyId,
+            ue_context_pP->ue_context.rnti,
+            ue_context_target_p->ue_id_rnti,
+            ctxt_pP->module_id,
+            mod_id_target);
+      ue_context_target_p->ue_context.handover_info =
+        CALLOC(1, sizeof(*(ue_context_target_p->ue_context.handover_info)));
+      memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_context,
+             (void*)&ue_context_pP->ue_context.handover_info->as_context,
+             sizeof(AS_Context_t));
+      memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_config,
+             (void*)&ue_context_pP->ue_context.handover_info->as_config,
+             sizeof(AS_Config_t));
+      ue_context_target_p->ue_context.handover_info->ho_prepare = 0x00;// 0xFF;
+      ue_context_target_p->ue_context.handover_info->ho_complete = 0;
+      ue_context_pP->ue_context.handover_info->modid_t = mod_id_target;
+      ue_context_pP->ue_context.handover_info->ueid_s  = ue_context_pP->ue_context.rnti;
+      ue_context_pP->ue_context.handover_info->modid_s = ctxt_pP->module_id;
+      ue_context_target_p->ue_context.handover_info->modid_t = mod_id_target;
+      ue_context_target_p->ue_context.handover_info->modid_s = ctxt_pP->module_id;
+      ue_context_target_p->ue_context.handover_info->ueid_t  = ue_context_target_p->ue_context.rnti;
+
+    } else {
+      LOG_E(RRC, "\nError in obtaining free UE id in target eNB %ld for handover \n", targetPhyId);
+    }
+
+  } else {
+    LOG_E(RRC, "\nError in obtaining Module ID of target eNB for handover \n");
+  }
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_process_handoverPreparationInformation(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*           const ue_context_pP
+)
+//-----------------------------------------------------------------------------
+{
+  T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+
+  LOG_I(RRC,
+        "[eNB %d] Frame %d : Logical Channel UL-DCCH, processing RRCHandoverPreparationInformation, sending RRCConnectionReconfiguration to UE %d \n",
+        ctxt_pP->module_id, ctxt_pP->frame, ue_context_pP->ue_context.rnti);
+  rrc_eNB_generate_RRCConnectionReconfiguration_handover(
+    ctxt_pP,
+    ue_context_pP,
+    NULL,
+    0);
+}
+
+
+//-----------------------------------------------------------------------------
+void
+check_handovers(
+  protocol_ctxt_t* const ctxt_pP
+)
+//-----------------------------------------------------------------------------
+{
+  int                                 result;
+  struct rrc_eNB_ue_context_s*        ue_context_p;
+  RB_FOREACH(ue_context_p, rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head) {
+    ctxt_pP->rnti  = ue_context_p->ue_id_rnti;
+
+    if (ue_context_p->ue_context.handover_info != NULL) {
+      if (ue_context_p->ue_context.handover_info->ho_prepare == 0xFF) {
+        LOG_D(RRC,
+              "[eNB %d] Frame %d: Incoming handover detected for new UE_idx %d (source eNB %d->target eNB %d) \n",
+              ctxt_pP->module_id,
+              ctxt_pP->frame,
+              ctxt_pP->rnti,
+              ctxt_pP->module_id,
+              ue_context_p->ue_context.handover_info->modid_t);
+        // source eNB generates rrcconnectionreconfiguration to prepare the HO
+        rrc_eNB_process_handoverPreparationInformation(
+          ctxt_pP,
+          ue_context_p);
+        ue_context_p->ue_context.handover_info->ho_prepare = 0xF1;
+      }
+
+      if (ue_context_p->ue_context.handover_info->ho_complete == 0xF1) {
+        LOG_D(RRC,
+              "[eNB %d] Frame %d: handover Command received for new UE_id  %x current eNB %d target eNB: %d \n",
+              ctxt_pP->module_id,
+              ctxt_pP->frame,
+              ctxt_pP->rnti,
+              ctxt_pP->module_id,
+              ue_context_p->ue_context.handover_info->modid_t);
+        //rrc_eNB_process_handoverPreparationInformation(enb_mod_idP,frameP,i);
+        result = pdcp_data_req(ctxt_pP,
+                               SRB_FLAG_YES,
+                               DCCH,
+                               rrc_eNB_mui++,
+                               SDU_CONFIRM_NO,
+                               ue_context_p->ue_context.handover_info->size,
+                               ue_context_p->ue_context.handover_info->buf,
+                               PDCP_TRANSMISSION_MODE_CONTROL);
+        AssertFatal(result == TRUE, "PDCP data request failed!\n");
+        ue_context_p->ue_context.handover_info->ho_complete = 0xF2;
+      }
+    }
+  }
+}
+
+// 5.3.5.4 RRCConnectionReconfiguration including the mobilityControlInfo to prepare the UE handover
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_RRCConnectionReconfiguration_handover(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*           const ue_context_pP,
+  uint8_t*                const nas_pdu,
+  const uint32_t                nas_length
+)
+//-----------------------------------------------------------------------------
+{
+  T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+
+  uint8_t                             buffer[RRC_BUF_SIZE];
+  uint16_t                            size;
+  int                                 i;
+  uint8_t                             rv[2];
+  uint16_t                            Idx;
+  // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE
+  eNB_RRC_INST*                       rrc_inst = RC.rrc[ctxt_pP->module_id];
+  struct PhysicalConfigDedicated**    physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated;
+
+  struct SRB_ToAddMod                *SRB2_config;
+  struct SRB_ToAddMod__rlc_Config    *SRB2_rlc_config;
+  struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config;
+  struct LogicalChannelConfig__ul_SpecificParameters *SRB2_ul_SpecificParameters;
+  LogicalChannelConfig_t             *SRB1_logicalChannelConfig = NULL;
+  SRB_ToAddModList_t*                 SRB_configList = ue_context_pP->ue_context.SRB_configList;    // not used in this context: may be removed
+  SRB_ToAddModList_t                 *SRB_configList2;
+
+  struct DRB_ToAddMod                *DRB_config;
+  struct RLC_Config                  *DRB_rlc_config;
+  struct PDCP_Config                 *DRB_pdcp_config;
+  struct PDCP_Config__rlc_UM         *PDCP_rlc_UM;
+  struct LogicalChannelConfig        *DRB_lchan_config;
+  struct LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters;
+  DRB_ToAddModList_t                 *DRB_configList2;
+
+  MAC_MainConfig_t                   *mac_MainConfig;
+  MeasObjectToAddModList_t           *MeasObj_list;
+  MeasObjectToAddMod_t               *MeasObj;
+  ReportConfigToAddModList_t         *ReportConfig_list;
+  ReportConfigToAddMod_t             *ReportConfig_per, *ReportConfig_A1,
+                                     *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5;
+  MeasIdToAddModList_t               *MeasId_list;
+  MeasIdToAddMod_t                   *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5;
+  QuantityConfig_t                   *quantityConfig;
+  MobilityControlInfo_t              *mobilityInfo;
+  // HandoverCommand_t handoverCommand;
+  //uint8_t                             sourceModId =
+  //  get_adjacent_cell_mod_id(ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->sourcePhysCellId);
+#if defined(Rel10) || defined(Rel14)
+  long                               *sr_ProhibitTimer_r9;
+#endif
+
+  long                               *logicalchannelgroup, *logicalchannelgroup_drb;
+  long                               *maxHARQ_Tx, *periodicBSR_Timer;
+
+  // RSRP_Range_t *rsrp;
+  struct MeasConfig__speedStatePars  *Sparams;
+  CellsToAddMod_t                    *CellToAdd;
+  CellsToAddModList_t                *CellsToAddModList;
+  // srb 1: for HO
+  struct SRB_ToAddMod                *SRB1_config;
+  struct SRB_ToAddMod__rlc_Config    *SRB1_rlc_config;
+  struct SRB_ToAddMod__logicalChannelConfig *SRB1_lchan_config;
+  struct LogicalChannelConfig__ul_SpecificParameters *SRB1_ul_SpecificParameters;
+  // phy config dedicated
+  PhysicalConfigDedicated_t          *physicalConfigDedicated2;
+  struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList;
+  protocol_ctxt_t                     ctxt;
+
+  LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: get the newSourceUEIdentity (C-RNTI): ",
+        ctxt_pP->module_id, ctxt_pP->frame);
+
+  for (i = 0; i < 2; i++) {
+    rv[i] = taus() & 0xff;
+    LOG_D(RRC, " %x.", rv[i]);
+  }
+
+  LOG_D(RRC, "[eNB %d] Frame %d : handover reparation: add target eNB SRB1 and PHYConfigDedicated reconfiguration\n",
+        ctxt_pP->module_id, ctxt_pP->frame);
+  // 1st: reconfigure SRB
+  SRB_configList2 = CALLOC(1, sizeof(*SRB_configList));
+  SRB1_config = CALLOC(1, sizeof(*SRB1_config));
+  SRB1_config->srb_Identity = 1;
+  SRB1_rlc_config = CALLOC(1, sizeof(*SRB1_rlc_config));
+  SRB1_config->rlc_Config = SRB1_rlc_config;
+
+  SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue;
+  SRB1_rlc_config->choice.explicitValue.present = RLC_Config_PR_am;
+  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15;
+  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8;
+  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000;
+  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t16;
+  SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
+  SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10;
+
+  SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config));
+  SRB1_config->logicalChannelConfig = SRB1_lchan_config;
+
+  SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue;
+  SRB1_ul_SpecificParameters = CALLOC(1, sizeof(*SRB1_ul_SpecificParameters));
+
+  SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters;
+
+  SRB1_ul_SpecificParameters->priority = 1;
+
+  //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity);
+  SRB1_ul_SpecificParameters->prioritisedBitRate =
+    LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+
+  //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50);
+  SRB1_ul_SpecificParameters->bucketSizeDuration =
+    LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+  logicalchannelgroup = CALLOC(1, sizeof(long));
+  *logicalchannelgroup = 0;
+  SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup;
+
+  ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB1_config);
+
+  //2nd: now reconfigure phy config dedicated
+  physicalConfigDedicated2 = CALLOC(1, sizeof(*physicalConfigDedicated2));
+  *physicalConfigDedicated = physicalConfigDedicated2;
+
+  physicalConfigDedicated2->pdsch_ConfigDedicated =
+    CALLOC(1, sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated));
+  physicalConfigDedicated2->pucch_ConfigDedicated =
+    CALLOC(1, sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated));
+  physicalConfigDedicated2->pusch_ConfigDedicated =
+    CALLOC(1, sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated));
+  physicalConfigDedicated2->uplinkPowerControlDedicated =
+    CALLOC(1, sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated));
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH =
+    CALLOC(1, sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH));
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH =
+    CALLOC(1, sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH));
+  physicalConfigDedicated2->cqi_ReportConfig = NULL;  //CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig));
+  physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated));
+  physicalConfigDedicated2->antennaInfo = CALLOC(1, sizeof(*physicalConfigDedicated2->antennaInfo));
+  physicalConfigDedicated2->schedulingRequestConfig =
+    CALLOC(1, sizeof(*physicalConfigDedicated2->schedulingRequestConfig));
+  // PDSCH
+  //assign_enum(&physicalConfigDedicated2->pdsch_ConfigDedicated->p_a,
+  //          PDSCH_ConfigDedicated__p_a_dB0);
+  physicalConfigDedicated2->pdsch_ConfigDedicated->p_a = PDSCH_ConfigDedicated__p_a_dB0;
+
+  // PUCCH
+  physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.present =
+    PUCCH_ConfigDedicated__ackNackRepetition_PR_release;
+  physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.choice.release = 0;
+  physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode = NULL;    //PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing;
+
+  // Pusch_config_dedicated
+  physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 0;  // 2.00
+  physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index = 0;   // 1.25
+  physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 8;  // 2.25
+
+  // UplinkPowerControlDedicated
+  physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUSCH = 0; // 0 dB
+  //assign_enum(&physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled,
+  // UplinkPowerControlDedicated__deltaMCS_Enabled_en1);
+  physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled =
+    UplinkPowerControlDedicated__deltaMCS_Enabled_en1;
+  physicalConfigDedicated2->uplinkPowerControlDedicated->accumulationEnabled = 1; // should be TRUE in order to have 0dB power offset
+  physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUCCH = 0; // 0 dB
+  physicalConfigDedicated2->uplinkPowerControlDedicated->pSRS_Offset = 0; // 0 dB
+  physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient =
+    CALLOC(1, sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient));
+  //  assign_enum(physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient,FilterCoefficient_fc4); // fc4 dB
+  *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = FilterCoefficient_fc4;  // fc4 dB
+
+  // TPC-PDCCH-Config
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->present = TPC_PDCCH_Config_PR_setup;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf = CALLOC(1, 2);
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.size = 2;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[0] = 0x12;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.bits_unused = 0;
+
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->present = TPC_PDCCH_Config_PR_setup;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf = CALLOC(1, 2);
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.size = 2;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[0] = 0x22;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid;
+  physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.bits_unused = 0;
+
+  // CQI ReportConfig
+  /*
+     physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic));
+     assign_enum(physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic,
+     CQI_ReportConfig__cqi_ReportModeAperiodic_rm30); // HLC CQI, no PMI
+     physicalConfigDedicated2->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0; // 0 dB
+     physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic));
+     physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present =  CQI_ReportPeriodic_PR_setup;
+     physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0;  // n2_pucch
+     physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex = 0;  // Icqi/pmi
+     physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present = CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI;  // subband CQI
+     physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k=4;
+
+     physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL;
+     physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0;
+   */
+
+  //soundingRS-UL-ConfigDedicated
+  /*
+     physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup;
+     assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth,
+     SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0);
+     assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth,
+     SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0);
+     physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0;
+     physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1;
+     physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=1;
+     physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb=0;
+     assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift,
+     SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0);
+   */
+
+  //AntennaInfoDedicated
+  physicalConfigDedicated2->antennaInfo = CALLOC(1, sizeof(*physicalConfigDedicated2->antennaInfo));
+  physicalConfigDedicated2->antennaInfo->present = PhysicalConfigDedicated__antennaInfo_PR_explicitValue;
+  //assign_enum(&physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode,
+  //     AntennaInfoDedicated__transmissionMode_tm2);
+  /*
+     switch (transmission_mode){
+     case 1:
+     physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm1;
+     break;
+     case 2:
+     physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm2;
+     break;
+     case 4:
+     physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm4;
+     break;
+     case 5:
+     physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm5;
+     break;
+     case 6:
+     physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm6;
+     break;
+     }
+   */
+  physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.present =
+    AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release;
+  physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.release = 0;
+
+  // SchedulingRequestConfig
+  physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup;
+  physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = ue_context_pP->local_uid;
+
+  if (rrc_inst->carrier[0].sib1->tdd_Config==NULL) {  // FD
+    physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5 + (ue_context_pP->local_uid %
+        10);   // Isr = 5 (every 10 subframes, offset=2+UE_id mod3)
+  } else {
+    switch (rrc_inst->carrier[0].sib1->tdd_Config->subframeAssignment) {
+    case 1:
+      physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & 1) + ((
+            ue_context_pP->local_uid & 3) >> 1) * 5;    // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..)
+      break;
+
+    case 3:
+      physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid %
+          3);    // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..)
+      break;
+
+    case 4:
+      physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid &
+          1);    // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..)
+      break;
+
+    default:
+      physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..)
+      break;
+    }
+  }
+
+  //  assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax,
+  //SchedulingRequestConfig__setup__dsr_TransMax_n4);
+  //  assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4;
+  physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax =
+    SchedulingRequestConfig__setup__dsr_TransMax_n4;
+
+  LOG_D(RRC,
+        "handover_config [FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ  (SRB1 UE %x) --->][MAC_eNB][MOD %02d][]\n",
+        ctxt_pP->frame, ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ctxt_pP->module_id);
+  rrc_mac_config_req_eNB(
+			 ctxt_pP->module_id,
+			 ue_context_pP->ue_context.primaryCC_id,
+			 0,0,0,0,0,
+#ifdef Rel14 
+0,
+#endif 
+			 ue_context_pP->ue_context.rnti,
+			 (BCCH_BCH_Message_t *) NULL,
+			 (RadioResourceConfigCommonSIB_t*) NULL,
+#ifdef Rel14
+			 (RadioResourceConfigCommonSIB_t*) NULL,
+#endif
+			 ue_context_pP->ue_context.physicalConfigDedicated,
+#if defined(Rel10) || defined(Rel14)
+			 (SCellToAddMod_r10_t *)NULL,
+			 //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
+			 (MeasObjectToAddMod_t **) NULL,
+			 ue_context_pP->ue_context.mac_MainConfig,
+			 1,
+			 SRB1_logicalChannelConfig,
+			 ue_context_pP->ue_context.measGapConfig,
+			 (TDD_Config_t*) NULL,
+			 (MobilityControlInfo_t*) NULL,
+			 (SchedulingInfoList_t*) NULL,
+			 0,
+			 NULL,
+			 NULL,
+			 (MBSFN_SubframeConfigList_t *) NULL
+#if defined(Rel10) || defined(Rel14)
+			 , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL
+#endif
+#   ifdef Rel14
+			 ,
+			 (SystemInformationBlockType1_v1310_IEs_t *)NULL
+#   endif
+			 );
+  
+  // Configure target eNB SRB2
+  /// SRB2
+  SRB2_config = CALLOC(1, sizeof(*SRB2_config));
+  SRB_configList2 = CALLOC(1, sizeof(*SRB_configList2));
+  memset(SRB_configList2, 0, sizeof(*SRB_configList2));
+
+  SRB2_config->srb_Identity = 2;
+  SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config));
+  SRB2_config->rlc_Config = SRB2_rlc_config;
+
+  SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue;
+  SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000;
+  SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32;
+  SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
+  SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10;
+
+  SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config));
+  SRB2_config->logicalChannelConfig = SRB2_lchan_config;
+
+  SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue;
+
+  SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters));
+
+  SRB2_ul_SpecificParameters->priority = 1;
+  SRB2_ul_SpecificParameters->prioritisedBitRate =
+    LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+  SRB2_ul_SpecificParameters->bucketSizeDuration =
+    LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+  // LCG for CCCH and DCCH is 0 as defined in 36331
+  logicalchannelgroup = CALLOC(1, sizeof(long));
+  *logicalchannelgroup = 0;
+
+  SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup;
+  SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters;
+  ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
+  ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB2_config);
+
+  // Configure target eNB DRB
+  DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2));
+  /// DRB
+  DRB_config = CALLOC(1, sizeof(*DRB_config));
+
+  //DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32
+  // NN: this is the 1st DRB for this ue, so set it to 1
+  DRB_config->drb_Identity = (DRB_Identity_t) 1;  // (ue_mod_idP+1); //allowed values 1..32
+  DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long));
+  *(DRB_config->logicalChannelIdentity) = (long)3;
+  DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config));
+  DRB_config->rlc_Config = DRB_rlc_config;
+  DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional;
+  DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+  DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+  DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35;
+
+  DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
+  DRB_config->pdcp_Config = DRB_pdcp_config;
+  DRB_pdcp_config->discardTimer = NULL;
+  DRB_pdcp_config->rlc_AM = NULL;
+  PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM));
+  DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
+  PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
+  DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed;
+
+  DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config));
+  DRB_config->logicalChannelConfig = DRB_lchan_config;
+  DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
+  DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
+
+  DRB_ul_SpecificParameters->priority = 2;    // lower priority than srb1, srb2
+  DRB_ul_SpecificParameters->prioritisedBitRate =
+    LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+  DRB_ul_SpecificParameters->bucketSizeDuration =
+    LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+  // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
+  logicalchannelgroup_drb = CALLOC(1, sizeof(long));
+  *logicalchannelgroup_drb = 1;
+  DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
+
+  ASN_SEQUENCE_ADD(&DRB_configList2->list, DRB_config);
+
+  mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig));
+  ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig;
+
+  mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config));
+
+  maxHARQ_Tx = CALLOC(1, sizeof(long));
+  *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
+  mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx;
+
+  periodicBSR_Timer = CALLOC(1, sizeof(long));
+  *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64;
+  mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer;
+
+  mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320;
+
+  mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE
+
+  mac_MainConfig->drx_Config = NULL;
+
+  mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config));
+
+  mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup;
+  mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes
+
+  mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes
+
+  mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;  // Value dB1 =1 dB, dB3 = 3 dB
+
+#if defined(Rel10) || defined(Rel14)
+  sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long));
+  *sr_ProhibitTimer_r9 = 0;   // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR
+  mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1));
+  mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9;
+  //sps_RA_ConfigList_rlola = NULL;
+#endif
+  // Measurement ID list
+  MeasId_list = CALLOC(1, sizeof(*MeasId_list));
+  memset((void *)MeasId_list, 0, sizeof(*MeasId_list));
+
+  MeasId0 = CALLOC(1, sizeof(*MeasId0));
+  MeasId0->measId = 1;
+  MeasId0->measObjectId = 1;
+  MeasId0->reportConfigId = 1;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0);
+
+  MeasId1 = CALLOC(1, sizeof(*MeasId1));
+  MeasId1->measId = 2;
+  MeasId1->measObjectId = 1;
+  MeasId1->reportConfigId = 2;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1);
+
+  MeasId2 = CALLOC(1, sizeof(*MeasId2));
+  MeasId2->measId = 3;
+  MeasId2->measObjectId = 1;
+  MeasId2->reportConfigId = 3;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2);
+
+  MeasId3 = CALLOC(1, sizeof(*MeasId3));
+  MeasId3->measId = 4;
+  MeasId3->measObjectId = 1;
+  MeasId3->reportConfigId = 4;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3);
+
+  MeasId4 = CALLOC(1, sizeof(*MeasId4));
+  MeasId4->measId = 5;
+  MeasId4->measObjectId = 1;
+  MeasId4->reportConfigId = 5;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4);
+
+  MeasId5 = CALLOC(1, sizeof(*MeasId5));
+  MeasId5->measId = 6;
+  MeasId5->measObjectId = 1;
+  MeasId5->reportConfigId = 6;
+  ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5);
+
+  //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list;
+
+  // Add one EUTRA Measurement Object
+  MeasObj_list = CALLOC(1, sizeof(*MeasObj_list));
+  memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list));
+
+  // Configure MeasObject
+
+  MeasObj = CALLOC(1, sizeof(*MeasObj));
+  memset((void *)MeasObj, 0, sizeof(*MeasObj));
+
+  MeasObj->measObjectId = 1;
+  MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA;
+  MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090;
+  MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25;
+  MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t));
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1;
+  MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6;
+  MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL;   // Default is 15 or 0dB
+
+  MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList =
+    (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList));
+  CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList;
+
+  // Add adjacent cell lists (6 per eNB)
+  for (i = 0; i < 6; i++) {
+    CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd));
+    CellToAdd->cellIndex = i + 1;
+    CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i);
+    CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0;
+
+    ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd);
+  }
+
+  ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj);
+  //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
+
+  // Report Configurations for periodical, A1-A5 events
+  ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list));
+
+  ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per));
+
+  ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1));
+
+  ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2));
+
+  ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3));
+
+  ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4));
+
+  ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5));
+
+  ReportConfig_per->reportConfigId = 1;
+  ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_periodical;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose =
+    ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per);
+
+  ReportConfig_A1->reportConfigId = 2;
+  ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_event;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+    ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
+  a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.
+  a1_Threshold.choice.threshold_RSRP = 10;
+
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1);
+
+  ReportConfig_A2->reportConfigId = 3;
+  ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_event;
+  ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+    ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2;
+  ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2.
+  a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+  ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2.
+  a2_Threshold.choice.threshold_RSRP = 10;
+
+  ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2);
+
+  ReportConfig_A3->reportConfigId = 4;
+  ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_event;
+  ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+    ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3;
+  ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset =
+    10;
+  ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+  eventA3.reportOnLeave = 1;
+
+  ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3);
+
+  ReportConfig_A4->reportConfigId = 5;
+  ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_event;
+  ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+    ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4;
+  ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4.
+  a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP;
+  ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4.
+  a4_Threshold.choice.threshold_RSRP = 10;
+
+  ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4);
+
+  ReportConfig_A5->reportConfigId = 6;
+  ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
+  ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present =
+    ReportConfigEUTRA__triggerType_PR_event;
+  ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present =
+    ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5;
+  ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+  eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP;
+  ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+  eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP;
+  ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+  eventA5.a5_Threshold1.choice.threshold_RSRP = 10;
+  ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
+  eventA5.a5_Threshold2.choice.threshold_RSRP = 10;
+
+  ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
+  ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
+  ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
+  ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120;
+  ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
+
+  ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5);
+
+  Sparams = CALLOC(1, sizeof(*Sparams));
+  Sparams->present = MeasConfig__speedStatePars_PR_setup;
+  Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75;
+  Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5;
+  Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10;
+  Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5;
+  Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60;
+  Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120;
+
+  quantityConfig = CALLOC(1, sizeof(*quantityConfig));
+  memset((void *)quantityConfig, 0, sizeof(*quantityConfig));
+  quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA));
+  memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA));
+  quantityConfig->quantityConfigCDMA2000 = NULL;
+  quantityConfig->quantityConfigGERAN = NULL;
+  quantityConfig->quantityConfigUTRA = NULL;
+  quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP =
+    CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP));
+  quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ =
+    CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ));
+  *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4;
+  *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4;
+
+  /* mobilityinfo  */
+
+  mobilityInfo = CALLOC(1, sizeof(*mobilityInfo));
+  memset((void *)mobilityInfo, 0, sizeof(*mobilityInfo));
+  mobilityInfo->targetPhysCellId =
+    (PhysCellId_t) two_tier_hexagonal_cellIds[ue_context_pP->ue_context.handover_info->modid_t];
+  LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: targetPhysCellId: %ld mod_id: %d ue: %x \n",
+        ctxt_pP->module_id,
+        ctxt_pP->frame,
+        mobilityInfo->targetPhysCellId,
+        ctxt_pP->module_id,
+        ue_context_pP->ue_context.rnti);
+
+  mobilityInfo->additionalSpectrumEmission = CALLOC(1, sizeof(*mobilityInfo->additionalSpectrumEmission));
+  *mobilityInfo->additionalSpectrumEmission = 1;  //Check this value!
+
+  mobilityInfo->t304 = MobilityControlInfo__t304_ms50;    // need to configure an appropriate value here
+
+  // New UE Identity (C-RNTI) to identify an UE uniquely in a cell
+  mobilityInfo->newUE_Identity.size = 2;
+  mobilityInfo->newUE_Identity.bits_unused = 0;
+  mobilityInfo->newUE_Identity.buf = rv;
+  mobilityInfo->newUE_Identity.buf[0] = rv[0];
+  mobilityInfo->newUE_Identity.buf[1] = rv[1];
+
+  //memset((void *)&mobilityInfo->radioResourceConfigCommon,(void *)&rrc_inst->sib2->radioResourceConfigCommon,sizeof(RadioResourceConfigCommon_t));
+  //memset((void *)&mobilityInfo->radioResourceConfigCommon,0,sizeof(RadioResourceConfigCommon_t));
+
+  // Configuring radioResourceConfigCommon
+  mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon =
+    CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon));
+  memcpy((void *)mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon,
+         (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.rach_ConfigCommon, sizeof(RACH_ConfigCommon_t));
+  mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo =
+    CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo));
+  memcpy((void *)mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo,
+         (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo,
+         sizeof(PRACH_ConfigInfo_t));
+
+  mobilityInfo->radioResourceConfigCommon.prach_Config.rootSequenceIndex =
+    rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.rootSequenceIndex;
+  mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon =
+    CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon));
+  memcpy((void *)mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon,
+         (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pdsch_ConfigCommon, sizeof(PDSCH_ConfigCommon_t));
+  memcpy((void *)&mobilityInfo->radioResourceConfigCommon.pusch_ConfigCommon,
+         (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pusch_ConfigCommon, sizeof(PUSCH_ConfigCommon_t));
+  mobilityInfo->radioResourceConfigCommon.phich_Config = NULL;
+  mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon =
+    CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon));
+  memcpy((void *)mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon,
+         (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pucch_ConfigCommon, sizeof(PUCCH_ConfigCommon_t));
+  mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon =
+    CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon));
+  memcpy((void *)mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon,
+         (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon,
+         sizeof(SoundingRS_UL_ConfigCommon_t));
+  mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon =
+    CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon));
+  memcpy((void *)mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon,
+         (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.uplinkPowerControlCommon,
+         sizeof(UplinkPowerControlCommon_t));
+  mobilityInfo->radioResourceConfigCommon.antennaInfoCommon = NULL;
+  mobilityInfo->radioResourceConfigCommon.p_Max = NULL;   // CALLOC(1,sizeof(*mobilityInfo->radioResourceConfigCommon.p_Max));
+  //memcpy((void *)mobilityInfo->radioResourceConfigCommon.p_Max,(void *)rrc_inst->sib1->p_Max,sizeof(P_Max_t));
+  mobilityInfo->radioResourceConfigCommon.tdd_Config = NULL;  //CALLOC(1,sizeof(TDD_Config_t));
+  //memcpy((void *)mobilityInfo->radioResourceConfigCommon.tdd_Config,(void *)rrc_inst->sib1->tdd_Config,sizeof(TDD_Config_t));
+  mobilityInfo->radioResourceConfigCommon.ul_CyclicPrefixLength =
+    rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.ul_CyclicPrefixLength;
+  //End of configuration of radioResourceConfigCommon
+
+  mobilityInfo->carrierFreq = CALLOC(1, sizeof(*mobilityInfo->carrierFreq));  //CALLOC(1,sizeof(CarrierFreqEUTRA_t)); 36090
+  mobilityInfo->carrierFreq->dl_CarrierFreq = 36090;
+  mobilityInfo->carrierFreq->ul_CarrierFreq = NULL;
+
+  mobilityInfo->carrierBandwidth = CALLOC(1, sizeof(
+      *mobilityInfo->carrierBandwidth));    //CALLOC(1,sizeof(struct CarrierBandwidthEUTRA));  AllowedMeasBandwidth_mbw25
+  mobilityInfo->carrierBandwidth->dl_Bandwidth = CarrierBandwidthEUTRA__dl_Bandwidth_n25;
+  mobilityInfo->carrierBandwidth->ul_Bandwidth = NULL;
+  mobilityInfo->rach_ConfigDedicated = NULL;
+
+  // store the srb and drb list for ho management, mainly in case of failure
+
+  memcpy(ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList,
+         (void*)SRB_configList2,
+         sizeof(SRB_ToAddModList_t));
+  memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList,
+         (void*)DRB_configList2,
+         sizeof(DRB_ToAddModList_t));
+  ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL;
+  memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig,
+         (void*)mac_MainConfig,
+         sizeof(MAC_MainConfig_t));
+  memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated,
+         (void*)ue_context_pP->ue_context.physicalConfigDedicated,
+         sizeof(PhysicalConfigDedicated_t));
+  /*    memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,
+     (void *)rrc_inst->sps_Config[ue_mod_idP],
+     sizeof(SPS_Config_t));
+   */
+  LOG_I(RRC, "[eNB %d] Frame %d: adding new UE\n",
+        ctxt_pP->module_id, ctxt_pP->frame);
+  //Idx = (ue_mod_idP * NB_RB_MAX) + DCCH;
+  Idx = DCCH;
+  // SRB1
+  ue_context_pP->ue_context.Srb1.Active = 1;
+  ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = Idx;
+  memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
+  memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
+
+  // SRB2 
+  ue_context_pP->ue_context.Srb2.Active = 1;
+  ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = Idx;
+  memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
+  memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
+
+  LOG_I(RRC, "[eNB %d] CALLING RLC CONFIG SRB1 (rbid %d) for UE %x\n",
+        ctxt_pP->module_id, Idx, ue_context_pP->ue_context.rnti);
+
+  //      rrc_pdcp_config_req (enb_mod_idP, frameP, 1, CONFIG_ACTION_ADD, idx, UNDEF_SECURITY_MODE);
+  //      rrc_rlc_config_req(enb_mod_idP,frameP,1,CONFIG_ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
+
+  rrc_pdcp_config_asn1_req(&ctxt,
+                           ue_context_pP->ue_context.SRB_configList,
+                           (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL, 0xff, NULL, NULL, NULL
+#if defined(Rel10) || defined(Rel14)
+                           , (PMCH_InfoList_r9_t *) NULL
+#endif
+                           ,NULL);
+
+  rrc_rlc_config_asn1_req(&ctxt,
+                          ue_context_pP->ue_context.SRB_configList,
+                          (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL
+#if defined(Rel10) || defined(Rel14)
+                          , (PMCH_InfoList_r9_t *) NULL
+#endif
+                         );
+
+  /* Initialize NAS list */
+  dedicatedInfoNASList = NULL;
+
+  //  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list;
+  memset(buffer, 0, RRC_BUF_SIZE);
+
+  size = do_RRCConnectionReconfiguration(
+           ctxt_pP,
+           buffer,
+           rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),   //Transaction_id,
+           SRB_configList2,
+           DRB_configList2,
+           NULL,  // DRB2_list,
+           NULL,    //*sps_Config,
+           ue_context_pP->ue_context.physicalConfigDedicated,
+           MeasObj_list,
+           ReportConfig_list,
+           NULL,    //quantityConfig,
+           MeasId_list,
+           mac_MainConfig,
+           NULL,
+           mobilityInfo,
+           Sparams,
+           NULL,
+           NULL,
+           dedicatedInfoNASList
+#if defined(Rel10) || defined(Rel14)
+           , NULL   // SCellToAddMod_r10_t
+#endif
+         );
+
+  LOG_I(RRC,
+        "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration for handover (bytes %d, UE rnti %x)\n",
+        ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
+  // to be updated if needed
+  /*if (RC.rrc[ctxt_pP->module_id]->SRB1_config[ue_mod_idP]->logicalChannelConfig) {
+     if (RC.rrc[ctxt_pP->module_id]->SRB1_config[ue_mod_idP]->logicalChannelConfig->present == SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) {
+     SRB1_logicalChannelConfig = &RC.rrc[ctxt_pP->module_id]->SRB1_config[ue_mod_idP]->logicalChannelConfig->choice.explicitValue;
+     }
+     else {
+     SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
+     }
+     }
+     else {
+     SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
+     }
+   */
+
+  LOG_D(RRC,
+        "[FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration_handover to UE %x MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
+        ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH);
+  //rrc_rlc_data_req(ctxt_pP->module_id,frameP, 1,(ue_mod_idP*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer);
+  //pdcp_data_req (ctxt_pP->module_id, frameP, 1, (ue_mod_idP * NB_RB_MAX) + DCCH,rrc_eNB_mui++, 0, size, (char *) buffer, 1);
+
+  rrc_mac_config_req_eNB(
+			 ctxt_pP->module_id,
+			 ue_context_pP->ue_context.primaryCC_id,
+			 0,0,0,0,0,
+#ifdef Rel14 
+			 0,
+#endif
+			 ue_context_pP->ue_context.rnti,
+			 (BCCH_BCH_Message_t *) NULL,
+			 (RadioResourceConfigCommonSIB_t *) NULL,
+#ifdef Rel14
+			 (RadioResourceConfigCommonSIB_t *) NULL,
+#endif
+			 ue_context_pP->ue_context.physicalConfigDedicated,
+#if defined(Rel10) || defined(Rel14)
+			 (SCellToAddMod_r10_t *)NULL,
+			 //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
+			 (MeasObjectToAddMod_t **) NULL,
+			 ue_context_pP->ue_context.mac_MainConfig,
+			 1,
+			 SRB1_logicalChannelConfig,
+			 ue_context_pP->ue_context.measGapConfig,
+			 (TDD_Config_t *) NULL,
+			 (MobilityControlInfo_t *) mobilityInfo,
+			 (SchedulingInfoList_t *) NULL, 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL
+#if defined(Rel10) || defined(Rel14)
+			 , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL
+#endif
+#   ifdef Rel14
+			 ,
+			 (SystemInformationBlockType1_v1310_IEs_t *)NULL
+#   endif
+			 );
+  
+  /*
+     handoverCommand.criticalExtensions.present = HandoverCommand__criticalExtensions_PR_c1;
+     handoverCommand.criticalExtensions.choice.c1.present = HandoverCommand__criticalExtensions__c1_PR_handoverCommand_r8;
+     handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.buf = buffer;
+     handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.size = size;
+   */
+//#warning "COMPILATION PROBLEM"
+#ifdef PROBLEM_COMPILATION_RESOLVED
+
+  if (sourceModId != 0xFF) {
+    memcpy(RC.rrc[sourceModId].handover_info[RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ueid_s]->buf,
+           (void *)buffer, size);
+    RC.rrc[sourceModId].handover_info[RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ueid_s]->size = size;
+    RC.rrc[sourceModId].handover_info[RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ueid_s]->ho_complete =
+      0xF1;
+    //RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ho_complete = 0xFF;
+    LOG_D(RRC, "[eNB %d] Frame %d: setting handover complete to 0xF1 for (%d,%d) and to 0xFF for (%d,%d)\n",
+          ctxt_pP->module_id,
+          ctxt_pP->frame,
+          sourceModId,
+          RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ueid_s,
+          ctxt_pP->module_id,
+          ue_mod_idP);
+  } else
+    LOG_W(RRC,
+          "[eNB %d] Frame %d: rrc_eNB_generate_RRCConnectionReconfiguration_handover: Could not find source eNB mod_id.\n",
+          ctxt_pP->module_id, ctxt_pP->frame);
+
+#endif
+}
+
+/*
+  void ue_rrc_process_rrcConnectionReconfiguration(uint8_t enb_mod_idP,frame_t frameP,
+  RRCConnectionReconfiguration_t *rrcConnectionReconfiguration,
+  uint8_t CH_index) {
+
+  if (rrcConnectionReconfiguration->criticalExtensions.present == RRCConnectionReconfiguration__criticalExtensions_PR_c1)
+  if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) {
+
+  if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated) {
+  rrc_ue_process_radioResourceConfigDedicated(enb_mod_idP,frameP,CH_index,
+  rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated);
+
+  }
+
+  // check other fields for
+  }
+  }
+*/
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_process_RRCConnectionReconfigurationComplete(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*        ue_context_pP,
+  const uint8_t xid
+)
+//-----------------------------------------------------------------------------
+{
+  int                                 i, drb_id;
+#ifdef PDCP_USE_NETLINK
+  int                                 oip_ifup = 0;
+  int                                 dest_ip_offset = 0;
+  module_id_t                         ue_module_id   = -1;
+  /* avoid gcc warnings */
+  (void)oip_ifup;
+  (void)dest_ip_offset;
+  (void)ue_module_id;
+#endif
+
+  uint8_t                            *kRRCenc = NULL;
+  uint8_t                            *kRRCint = NULL;
+  uint8_t                            *kUPenc = NULL;
+  ue_context_pP->ue_context.ue_reestablishment_timer = 0;
+
+  DRB_ToAddModList_t*                 DRB_configList = ue_context_pP->ue_context.DRB_configList2[xid];
+  SRB_ToAddModList_t*                 SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid];
+  DRB_ToReleaseList_t*                DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid];
+  DRB_Identity_t*                     drb_id_p      = NULL;
+
+  T(T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+#if defined(ENABLE_SECURITY)
+
+  /* Derive the keys from kenb */
+  if (DRB_configList != NULL) {
+    derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm,
+                      ue_context_pP->ue_context.kenb, &kUPenc);
+  }
+
+  derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm,
+                     ue_context_pP->ue_context.kenb, &kRRCenc);
+  derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
+                     ue_context_pP->ue_context.kenb, &kRRCint);
+
+#endif
+
+  // Refresh SRBs/DRBs
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_PDCP_ENB,
+    NULL,
+    0,
+    MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti);
+
+  rrc_pdcp_config_asn1_req(
+    ctxt_pP,
+    SRB_configList, //NULL,  //LG-RK 14/05/2014 SRB_configList,
+    DRB_configList, 
+//    (DRB_ToReleaseList_t *) NULL,
+    DRB_Release_configList2,
+    /*RC.rrc[ctxt_pP->module_id]->ciphering_algorithm[ue_mod_idP] |
+             (RC.rrc[ctxt_pP->module_id]->integrity_algorithm[ue_mod_idP] << 4),
+     */
+    0xff, // already configured during the securitymodecommand
+    kRRCenc,
+    kRRCint,
+    kUPenc
+#if defined(Rel10) || defined(Rel14)
+    , (PMCH_InfoList_r9_t *) NULL
+#endif
+    ,NULL);
+  // Refresh SRBs/DRBs
+  rrc_rlc_config_asn1_req(
+    ctxt_pP,
+    SRB_configList, // NULL,  //LG-RK 14/05/2014 SRB_configList,
+    DRB_configList,
+//    (DRB_ToReleaseList_t *) NULL
+    DRB_Release_configList2
+#if defined(Rel10) || defined(Rel14)
+    , (PMCH_InfoList_r9_t *) NULL
+#endif
+  );
+  
+  // set the SRB active in Ue context
+  if (SRB_configList != NULL) {
+    for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) {
+      if (SRB_configList->list.array[i]->srb_Identity == 1 ){
+	ue_context_pP->ue_context.Srb1.Active=1;
+      }
+      else if (SRB_configList->list.array[i]->srb_Identity == 2 )  {
+	  ue_context_pP->ue_context.Srb2.Active=1;
+	  ue_context_pP->ue_context.Srb2.Srb_info.Srb_id=2;
+	     LOG_I(RRC,"[eNB %d] Frame  %d CC %d : SRB2 is now active\n",
+		ctxt_pP->module_id,
+		ctxt_pP->frame,
+		ue_context_pP->ue_context.primaryCC_id);
+      } else {
+	LOG_W(RRC,"[eNB %d] Frame  %d CC %d : invalide SRB identity %ld\n",
+	      ctxt_pP->module_id,
+	      ctxt_pP->frame,
+              ue_context_pP->ue_context.primaryCC_id,
+	      SRB_configList->list.array[i]->srb_Identity);
+      }
+    }
+    free(SRB_configList);
+    ue_context_pP->ue_context.SRB_configList2[xid] = NULL;
+  }
+  
+  // Loop through DRBs and establish if necessary
+
+  if (DRB_configList != NULL) {
+    for (i = 0; i < DRB_configList->list.count; i++) {  // num max DRB (11-3-8)
+      if (DRB_configList->list.array[i]) {
+	drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
+        LOG_I(RRC,
+              "[eNB %d] Frame  %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n",
+              ctxt_pP->module_id,
+              ctxt_pP->frame,
+              ctxt_pP->rnti,
+              (int)DRB_configList->list.array[i]->drb_Identity,
+              (int)*DRB_configList->list.array[i]->logicalChannelIdentity);
+        // for pre-ci tests
+        LOG_I(RRC,
+              "[eNB %d] Frame  %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE %u, reconfiguring DRB %d/LCID %d\n",
+              ctxt_pP->module_id,
+              ctxt_pP->frame,
+              oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid],
+              (int)DRB_configList->list.array[i]->drb_Identity,
+              (int)*DRB_configList->list.array[i]->logicalChannelIdentity);
+
+        if (ue_context_pP->ue_context.DRB_active[drb_id] == 0) {
+          /*
+             rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_ADD,
+             (ue_mod_idP * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity,UNDEF_SECURITY_MODE);
+             rrc_rlc_config_req(ctxt_pP->module_id,frameP,1,CONFIG_ACTION_ADD,
+             (ue_mod_idP * NB_RB_MAX) + (int)*RC.rrc[ctxt_pP->module_id]->DRB_config[ue_mod_idP][i]->logicalChannelIdentity,
+             RADIO_ACCESS_BEARER,Rlc_info_um);
+           */
+          ue_context_pP->ue_context.DRB_active[drb_id] = 1;
+
+          LOG_D(RRC,
+                "[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n",
+                ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity);
+#if  defined(PDCP_USE_NETLINK) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
+          // can mean also IPV6 since ether -> ipv6 autoconf
+#   if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(OAI_ADRV9371_ZC706)
+          LOG_I(OIP, "[eNB %d] trying to bring up the OAI interface oai%d\n",
+                ctxt_pP->module_id,
+                ctxt_pP->module_id);
+          oip_ifup = nas_config(
+                       ctxt_pP->module_id,   // interface index
+                       ctxt_pP->module_id + 1,   // thrid octet
+                       ctxt_pP->module_id + 1);  // fourth octet
+
+          if (oip_ifup == 0) {    // interface is up --> send a config the DRB
+            dest_ip_offset = 8;
+            LOG_I(OIP,
+                  "[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n",
+                  ctxt_pP->module_id, ctxt_pP->module_id,
+                  (long int)((ue_context_pP->local_uid * maxDRB) + DRB_configList->list.array[i]->drb_Identity));
+            ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid];
+            rb_conf_ipv4(0, //add
+                         ue_module_id,  //cx
+                         ctxt_pP->module_id,    //inst
+                         (ue_module_id * maxDRB) + DRB_configList->list.array[i]->drb_Identity, // RB
+                         0,    //dscp
+                         ipv4_address(ctxt_pP->module_id + 1, ctxt_pP->module_id + 1),  //saddr
+                         ipv4_address(ctxt_pP->module_id + 1, dest_ip_offset + ue_module_id + 1));  //daddr
+            LOG_D(RRC, "[eNB %d] State = Attached (UE rnti %x module id %u)\n",
+                  ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ue_module_id);
+          }
+
+#   endif
+#endif
+
+          LOG_D(RRC,
+                PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ  (DRB) ---> MAC_eNB\n",
+                PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+
+          if (DRB_configList->list.array[i]->logicalChannelIdentity) {
+            DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity;
+          }
+
+          rrc_mac_config_req_eNB(
+				 ctxt_pP->module_id,
+				 ue_context_pP->ue_context.primaryCC_id,
+				 0,0,0,0,0,
+#ifdef Rel14 
+				 0,
+#endif
+				 ue_context_pP->ue_context.rnti,
+				 (BCCH_BCH_Message_t *) NULL,
+				 (RadioResourceConfigCommonSIB_t *) NULL,
+#ifdef Rel14
+				 (RadioResourceConfigCommonSIB_t *) NULL,
+#endif
+				 ue_context_pP->ue_context.physicalConfigDedicated,
+#if defined(Rel10) || defined(Rel14)
+				 (SCellToAddMod_r10_t *)NULL,
+				 //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
+				 (MeasObjectToAddMod_t **) NULL,
+				 ue_context_pP->ue_context.mac_MainConfig,
+				 DRB2LCHAN[i],
+				 DRB_configList->list.array[i]->logicalChannelConfig,
+				 ue_context_pP->ue_context.measGapConfig,
+				 (TDD_Config_t *) NULL,
+				 NULL,
+				 (SchedulingInfoList_t *) NULL,
+				 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL
+#if defined(Rel10) || defined(Rel14)
+				 , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL
+#endif
+#   ifdef Rel14
+				 ,
+				 (SystemInformationBlockType1_v1310_IEs_t *)NULL
+#   endif
+				 );
+	  
+        } else {        // remove LCHAN from MAC/PHY
+
+          if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
+            // DRB has just been removed so remove RLC + PDCP for DRB
+            /*      rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE,
+               (ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE);
+             */
+            rrc_rlc_config_req(
+              ctxt_pP,
+              SRB_FLAG_NO,
+              MBMS_FLAG_NO,
+              CONFIG_ACTION_REMOVE,
+              DRB2LCHAN[i],
+              Rlc_info_um);
+          }
+
+          ue_context_pP->ue_context.DRB_active[drb_id] = 0;
+          LOG_D(RRC,
+                PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ  (DRB) ---> MAC_eNB\n",
+                PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+          rrc_mac_config_req_eNB(ctxt_pP->module_id,
+				 ue_context_pP->ue_context.primaryCC_id,
+				 0,0,0,0,0,
+#ifdef Rel14 
+				 0,
+#endif
+				 ue_context_pP->ue_context.rnti,
+				 (BCCH_BCH_Message_t *) NULL,
+				 (RadioResourceConfigCommonSIB_t *) NULL,
+#ifdef Rel14
+				 (RadioResourceConfigCommonSIB_t *) NULL,
+#endif
+				 ue_context_pP->ue_context.physicalConfigDedicated,
+#if defined(Rel10) || defined(Rel14)
+				 (SCellToAddMod_r10_t *)NULL,
+				 //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
+				 (MeasObjectToAddMod_t **) NULL,
+				 ue_context_pP->ue_context.mac_MainConfig,
+				 DRB2LCHAN[i],
+				 (LogicalChannelConfig_t *) NULL,
+				 (MeasGapConfig_t *) NULL,
+				 (TDD_Config_t *) NULL,
+				 NULL, 
+				 (SchedulingInfoList_t *) NULL,
+				 0, NULL, NULL, NULL
+#if defined(Rel10) || defined(Rel14)
+				 , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL
+#endif
+#   ifdef Rel14
+				 ,
+				 (SystemInformationBlockType1_v1310_IEs_t *)NULL
+#   endif
+				 );
+        }
+      }
+    }
+   free(DRB_configList);
+    ue_context_pP->ue_context.DRB_configList2[xid] = NULL;
+  }
+
+  if(DRB_Release_configList2 != NULL){
+      for (i = 0; i < DRB_Release_configList2->list.count; i++) {
+          if (DRB_Release_configList2->list.array[i]) {
+              drb_id_p = DRB_Release_configList2->list.array[i];
+              drb_id = *drb_id_p;
+              if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
+                  ue_context_pP->ue_context.DRB_active[drb_id] = 0;
+              }
+          }
+      }
+      free(DRB_Release_configList2);
+      ue_context_pP->ue_context.DRB_Release_configList2[xid] = NULL;
+  }
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_eNB_generate_RRCConnectionSetup(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*          const ue_context_pP,
+  const int                    CC_id
+)
+//-----------------------------------------------------------------------------
+{
+
+  LogicalChannelConfig_t             *SRB1_logicalChannelConfig;  //,*SRB2_logicalChannelConfig;
+  SRB_ToAddModList_t                **SRB_configList;
+  SRB_ToAddMod_t                     *SRB1_config;
+  int                                 cnt;
+
+  T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  SRB_configList = &ue_context_pP->ue_context.SRB_configList;
+  RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
+    do_RRCConnectionSetup(ctxt_pP,
+                          ue_context_pP,
+                          CC_id,
+                          (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload,
+			  (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2
+                          rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
+                          SRB_configList,
+                          &ue_context_pP->ue_context.physicalConfigDedicated);
+
+#ifdef RRC_MSG_PRINT
+  LOG_F(RRC,"[MSG] RRC Connection Setup\n");
+
+  for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) {
+    LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->Srb0.Tx_buffer.Payload)[cnt]);
+  }
+
+  LOG_F(RRC,"\n");
+  //////////////////////////////////
+#endif
+
+  // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE
+
+  if (*SRB_configList != NULL) {
+    for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) {
+      if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) {
+        SRB1_config = (*SRB_configList)->list.array[cnt];
+
+        if (SRB1_config->logicalChannelConfig) {
+          if (SRB1_config->logicalChannelConfig->present ==
+              SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) {
+            SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue;
+          } else {
+            SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
+          }
+        } else {
+          SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
+        }
+
+        LOG_D(RRC,
+              PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ  (SRB1) ---> MAC_eNB\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+        rrc_mac_config_req_eNB(
+			       ctxt_pP->module_id,
+			       ue_context_pP->ue_context.primaryCC_id,
+			       0,0,0,0,0,
+#ifdef Rel14 
+			       0,
+#endif
+			       ue_context_pP->ue_context.rnti,
+			       (BCCH_BCH_Message_t *) NULL,
+			       (RadioResourceConfigCommonSIB_t *) NULL,
+#ifdef Rel14
+			       (RadioResourceConfigCommonSIB_t *) NULL,
+#endif
+			       ue_context_pP->ue_context.physicalConfigDedicated,
+#if defined(Rel10) || defined(Rel14)
+			       (SCellToAddMod_r10_t *)NULL,
+			       //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
+			       (MeasObjectToAddMod_t **) NULL,
+			       ue_context_pP->ue_context.mac_MainConfig,
+			       1,
+			       SRB1_logicalChannelConfig,
+			       ue_context_pP->ue_context.measGapConfig,
+			       (TDD_Config_t *) NULL,
+			       NULL,
+			       (SchedulingInfoList_t *) NULL,
+			       0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL
+#if defined(Rel10) || defined(Rel14)
+			       , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL
+#endif
+#   ifdef Rel14
+			       ,
+			       (SystemInformationBlockType1_v1310_IEs_t *)NULL
+#   endif
+			       );
+        break;
+      }
+    }
+  }
+
+  MSC_LOG_TX_MESSAGE(
+    MSC_RRC_ENB,
+    MSC_RRC_UE,
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, // LG WARNING
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+    MSC_AS_TIME_FMT" RRCConnectionSetup UE %x size %u",
+    MSC_AS_TIME_ARGS(ctxt_pP),
+    ue_context_pP->ue_context.rnti,
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+
+
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionSetup (bytes %d)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+
+  // activate release timer, if RRCSetupComplete not received after 10 frames, remove UE
+  //ue_context_pP->ue_context.ue_release_timer=1;
+  // remove UE after 10 frames after RRCConnectionRelease is triggered
+  //ue_context_pP->ue_context.ue_release_timer_thres=100;
+     // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
+   ue_context_pP->ue_context.ue_release_timer=1;
+   // remove UE after 10 frames after RRCConnectionRelease is triggered
+   ue_context_pP->ue_context.ue_release_timer_thres=1000;
+}
+
+
+#if defined(ENABLE_ITTI)
+//-----------------------------------------------------------------------------
+char
+openair_rrc_eNB_configuration(
+  const module_id_t enb_mod_idP,
+  RrcConfigurationReq* configuration
+)
+#else
+char
+openair_rrc_eNB_init(
+  const module_id_t enb_mod_idP
+)
+#endif
+//-----------------------------------------------------------------------------
+{
+  protocol_ctxt_t ctxt;
+  int             CC_id;
+
+  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, 0, 0,enb_mod_idP);
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_FMT" Init...\n",
+        PROTOCOL_RRC_CTXT_ARGS(&ctxt));
+
+#if OCP_FRAMEWORK
+  while ( RC.rrc[enb_mod_idP] == NULL ) {
+    LOG_E(RRC, "RC.rrc not yet initialized, waiting 1 second\n");
+    sleep(1);
+  }
+#endif 
+  AssertFatal(RC.rrc[enb_mod_idP] != NULL, "RC.rrc not initialized!");
+  AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow");
+#ifdef ENABLE_ITTI
+  AssertFatal(configuration!=NULL,"configuration input is null\n");
+#endif
+  //    for (j = 0; j < NUMBER_OF_UE_MAX; j++)
+  //        RC.rrc[ctxt.module_id].Info.UE[j].Status = RRC_IDLE;  //CH_READY;
+  //
+  //#if defined(ENABLE_USE_MME)
+  //    // Connect eNB to MME
+  //    if (EPC_MODE_ENABLED <= 0)
+  //#endif
+  //    {
+  //        /* Init security parameters */
+  //        for (j = 0; j < NUMBER_OF_UE_MAX; j++) {
+  //            RC.rrc[ctxt.module_id].ciphering_algorithm[j] = SecurityAlgorithmConfig__cipheringAlgorithm_eea0;
+  //            RC.rrc[ctxt.module_id].integrity_algorithm[j] = SecurityAlgorithmConfig__integrityProtAlgorithm_eia2;
+  //            rrc_eNB_init_security(enb_mod_idP, j);
+  //        }
+  //    }
+  RC.rrc[ctxt.module_id]->Nb_ue = 0;
+
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+    RC.rrc[ctxt.module_id]->carrier[CC_id].Srb0.Active = 0;
+  }
+
+  uid_linear_allocator_init(&RC.rrc[ctxt.module_id]->uid_allocator);
+  RB_INIT(&RC.rrc[ctxt.module_id]->rrc_ue_head);
+  //    for (j = 0; j < (NUMBER_OF_UE_MAX + 1); j++) {
+  //        RC.rrc[enb_mod_idP]->Srb2[j].Active = 0;
+  //    }
+
+
+  RC.rrc[ctxt.module_id]->initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL);
+  RC.rrc[ctxt.module_id]->s1ap_id2_s1ap_ids    = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL);
+
+  memcpy(&RC.rrc[ctxt.module_id]->configuration,configuration,sizeof(RrcConfigurationReq));
+
+  /// System Information INIT
+
+  LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Checking release \n",
+        PROTOCOL_RRC_CTXT_ARGS(&ctxt));
+#if defined(Rel10) || defined(Rel14)
+
+  // can clear it at runtime
+  RC.rrc[ctxt.module_id]->carrier[0].MBMS_flag = 0;
+
+  // This has to come from some top-level configuration
+  // only CC_id 0 is logged
+#if defined(Rel10)
+  LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel10 RRC detected, MBMS flag %d\n",
+#else
+  LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel14 RRC detected, MBMS flag %d\n",
+#endif
+        PROTOCOL_RRC_CTXT_ARGS(&ctxt),
+        RC.rrc[ctxt.module_id]->carrier[0].MBMS_flag);
+
+#else
+  LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel8 RRC\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt));
+#endif
+#ifdef CBA
+
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+    for (j = 0; j < NUM_MAX_CBA_GROUP; j++) {
+      RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[j] = CBA_OFFSET + j;
+    }
+
+    if (RC.rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups > NUM_MAX_CBA_GROUP) {
+      RC.rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups = NUM_MAX_CBA_GROUP;
+    }
+
+    LOG_D(RRC,
+          PROTOCOL_RRC_CTXT_FMT" Initialization of 4 cba_RNTI values (%x %x %x %x) num active groups %d\n",
+          PROTOCOL_RRC_CTXT_ARGS(&ctxt),
+          enb_mod_idP, RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[0],
+          RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[1],
+          RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[2],
+          RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[3],
+          RC.rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups);
+  }
+
+#endif
+
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+    init_SI(&ctxt,
+            CC_id
+#if defined(ENABLE_ITTI)
+            , configuration
+#endif
+           );
+    for (int ue_id = 0; ue_id < NUMBER_OF_UE_MAX; ue_id++) {
+        RC.rrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0;
+        RC.rrc[ctxt.module_id]->carrier[CC_id].paging[ue_id] = (uint8_t*) malloc16(256);
+    }
+  }
+
+  rrc_init_global_param();
+  for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+
+#if defined(Rel10) || defined(Rel14)
+    switch (RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag) {
+    case 1:
+    case 2:
+    case 3:
+      LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 1 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt));
+      RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 1;
+      break;
+
+    case 4:
+      LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 2 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt));
+      RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 2;
+      break;
+
+    default:
+      RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 0;
+      break;
+    }
+
+    // if we are here the RC.rrc[enb_mod_idP]->MBMS_flag > 0,
+    /// MCCH INIT
+    if (RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag > 0) {
+      init_MCCH(ctxt.module_id, CC_id);
+      /// MTCH data bearer init
+      init_MBMS(ctxt.module_id, CC_id, 0);
+    }
+#endif
+
+    openair_rrc_top_init_eNB(RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag,0);
+  }
+  openair_rrc_on(&ctxt);
+
+  return 0;
+
+}
+
+/*------------------------------------------------------------------------------*/
+int
+rrc_eNB_decode_ccch(
+  protocol_ctxt_t* const ctxt_pP,
+  const SRB_INFO*        const Srb_info,
+  const int              CC_id
+)
+//-----------------------------------------------------------------------------
+{
+  module_id_t                                   Idx;
+  asn_dec_rval_t                      dec_rval;
+  UL_CCCH_Message_t                  *ul_ccch_msg = NULL;
+  RRCConnectionRequest_r8_IEs_t*                rrcConnectionRequest = NULL;
+  RRCConnectionReestablishmentRequest_r8_IEs_t* rrcConnectionReestablishmentRequest = NULL;
+  int                                 i, rval;
+  struct rrc_eNB_ue_context_s*                  ue_context_p = NULL;
+  uint64_t                                      random_value = 0;
+  int                                           stmsi_received = 0;
+
+  T(T_ENB_RRC_UL_CCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  //memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t));
+
+  LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        ((uint8_t*) Srb_info->Rx_buffer.Payload)[0],
+        ((uint8_t *) Srb_info->Rx_buffer.Payload)[1],
+        ((uint8_t *) Srb_info->Rx_buffer.Payload)[2],
+        ((uint8_t *) Srb_info->Rx_buffer.Payload)[3],
+        ((uint8_t *) Srb_info->Rx_buffer.Payload)[4],
+        ((uint8_t *) Srb_info->Rx_buffer.Payload)[5], (uint8_t *) Srb_info->Rx_buffer.Payload);
+  dec_rval = uper_decode(
+               NULL,
+               &asn_DEF_UL_CCCH_Message,
+               (void**)&ul_ccch_msg,
+               (uint8_t*) Srb_info->Rx_buffer.Payload,
+               100,
+               0,
+               0);
+
+  /*
+#if defined(ENABLE_ITTI)
+#   if defined(DISABLE_ITTI_XER_PRINT)
+  {
+    MessageDef                         *message_p;
+
+    message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_UL_CCCH_MESSAGE);
+    memcpy(&message_p->ittiMsg, (void *)ul_ccch_msg, sizeof(RrcUlCcchMessage));
+
+    itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p);
+  }
+#   else
+  {
+    char                                message_string[10000];
+    size_t                              message_string_size;
+
+    if ((message_string_size =
+           xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_CCCH_Message, (void *)ul_ccch_msg)) > 0) {
+      MessageDef                         *msg_p;
+
+      msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_CCCH, message_string_size + sizeof(IttiMsgText));
+      msg_p->ittiMsg.rrc_ul_ccch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_ul_ccch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
+    }
+  }
+#   endif
+#endif
+  */
+
+  for (i = 0; i < 8; i++) {
+    LOG_T(RRC, "%x.", ((uint8_t *) & ul_ccch_msg)[i]);
+  }
+
+  if (dec_rval.consumed == 0) {
+    LOG_E(RRC,
+          PROTOCOL_RRC_CTXT_UE_FMT" FATAL Error in receiving CCCH\n",
+          PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+    return -1;
+  }
+
+  if (ul_ccch_msg->message.present == UL_CCCH_MessageType_PR_c1) {
+
+    switch (ul_ccch_msg->message.choice.c1.present) {
+
+    case UL_CCCH_MessageType__c1_PR_NOTHING:
+      LOG_I(RRC,
+            PROTOCOL_RRC_CTXT_FMT" Received PR_NOTHING on UL-CCCH-Message\n",
+            PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
+      break;
+
+    case UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest:
+      T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+#ifdef RRC_MSG_PRINT
+      LOG_F(RRC,"[MSG] RRC Connection Reestablishment Request\n");
+
+      for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) {
+        LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]);
+      }
+
+      LOG_F(RRC,"\n");
+#endif
+      LOG_D(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) --> RRC_eNB\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+      rrcConnectionReestablishmentRequest =
+        &ul_ccch_msg->message.choice.c1.choice.rrcConnectionReestablishmentRequest.criticalExtensions.choice.rrcConnectionReestablishmentRequest_r8;
+      LOG_I(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest cause %s\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            ((rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_otherFailure) ?    "Other Failure" :
+             (rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_handoverFailure) ? "Handover Failure" :
+             "reconfigurationFailure"));
+      /*{
+      uint64_t                            c_rnti = 0;
+
+      memcpy(((uint8_t *) & c_rnti) + 3, rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.buf,
+      rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.size);
+      ue_mod_id = rrc_eNB_get_UE_index(enb_mod_idP, c_rnti);
+      }
+
+      if ((RC.rrc[enb_mod_idP]->phyCellId == rrcConnectionReestablishmentRequest.UE_identity.physCellId) &&
+      (ue_mod_id != UE_INDEX_INVALID)){
+      rrc_eNB_generate_RRCConnectionReestablishment(enb_mod_idP, frameP, ue_mod_id);
+      }else {
+      rrc_eNB_generate_RRCConnectionReestablishmentReject(enb_mod_idP, frameP, ue_mod_id);
+      }
+      */
+      /* reject all reestablishment attempts for the moment */
+//      rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP,
+//                       rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti),
+//                       CC_id);
+{
+      uint16_t                          c_rnti = 0;
+
+      if (rrcConnectionReestablishmentRequest->ue_Identity.physCellId != RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId) {
+        LOG_E(RRC,
+              PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%d), let's reject the UE\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+              rrcConnectionReestablishmentRequest->ue_Identity.physCellId,
+              RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId);
+        rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
+        break;
+      }
+      LOG_D(RRC, "physCellId is %ld\n", rrcConnectionReestablishmentRequest->ue_Identity.physCellId);
+
+      for (i = 0; i < rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.size; i++) {
+        LOG_D(RRC, "rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[%d] = %x\n",
+            i, rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[i]);
+      }
+
+      if (rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size == 0 ||
+          rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size > 2) {
+        LOG_E(RRC,
+              PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest c_RNTI range error, let's reject the UE\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+        rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
+        break;
+
+      }
+
+      c_rnti = BIT_STRING_to_uint16(&rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI);
+      LOG_D(RRC, "c_rnti is %x\n", c_rnti);
+
+      ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], c_rnti);
+      if (ue_context_p == NULL) {
+        LOG_E(RRC,
+              PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest without UE context, let's reject the UE\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+        rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
+        break;
+      }
+      int UE_id = find_UE_id(ctxt_pP->module_id, c_rnti);
+      if(ue_context_p->ue_context.ue_reestablishment_timer > 0 || RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer > 0){
+          LOG_I(RRC,
+                PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishment(Previous) don't complete, let's reject the UE\n",
+                PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+          rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
+          break;
+      }
+      LOG_D(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            ue_context_p);
+      ue_context_p->ue_context.ul_failure_timer = 0;
+      ue_context_p->ue_context.ue_release_timer = 0;
+      ue_context_p->ue_context.ue_reestablishment_timer = 0;
+      ue_context_p->ue_context.ue_release_timer_s1 = 0;
+      ue_context_p->ue_context.ue_release_timer_rrc = 0;
+
+      /* reset timers */
+      ue_context_p->ue_context.ul_failure_timer = 0;
+      ue_context_p->ue_context.ue_release_timer = 0;
+
+      // insert C-RNTI to map
+      for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
+        if (reestablish_rnti_map[i][0] == 0) {
+          reestablish_rnti_map[i][0] = ctxt_pP->rnti;
+          reestablish_rnti_map[i][1] = c_rnti;
+          break;
+        }
+      }
+      LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n",
+            i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]);
+
+#if defined(ENABLE_ITTI)
+      ue_context_p->ue_context.reestablishment_cause = rrcConnectionReestablishmentRequest->reestablishmentCause;
+      LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection reestablishment request from UE physCellId %ld cause %ld\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            rrcConnectionReestablishmentRequest->ue_Identity.physCellId,
+            ue_context_p->ue_context.reestablishment_cause);
+#else
+        LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection restablishment request for UE\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+#endif
+
+#ifndef NO_RRM
+      send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id));
+#else
+
+      ue_context_p->ue_context.primaryCC_id = CC_id;
+
+      //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH;
+      Idx = DCCH;
+      // SRB1
+      ue_context_p->ue_context.Srb1.Active = 1;
+      ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx;
+      memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0],
+             &DCCH_LCHAN_DESC,
+             LCHAN_DESC_SIZE);
+      memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1],
+             &DCCH_LCHAN_DESC,
+             LCHAN_DESC_SIZE);
+
+      // SRB2: set  it to go through SRB1 with id 1 (DCCH)
+      ue_context_p->ue_context.Srb2.Active = 1;
+      ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx;
+      memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0],
+             &DCCH_LCHAN_DESC,
+             LCHAN_DESC_SIZE);
+      memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1],
+             &DCCH_LCHAN_DESC,
+             LCHAN_DESC_SIZE);
+
+      rrc_eNB_generate_RRCConnectionReestablishment(ctxt_pP, ue_context_p, CC_id);
+      LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            Idx);
+
+      MSC_LOG_TX_MESSAGE(MSC_RRC_ENB,
+                         MSC_PDCP_ENB,
+                         NULL,
+                         0,
+                         MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB",
+                         MSC_AS_TIME_ARGS(ctxt_pP),
+                         ue_context_p->ue_context.rnti);
+
+      rrc_pdcp_config_asn1_req(ctxt_pP,
+                               ue_context_p->ue_context.SRB_configList,
+                               (DRB_ToAddModList_t *) NULL,
+                               (DRB_ToReleaseList_t*) NULL,
+                               0xff,
+                               NULL,
+                               NULL,
+                               NULL
+#   if defined(Rel10) || defined(Rel14)
+                               , (PMCH_InfoList_r9_t *) NULL
+#   endif
+                               ,NULL);
+
+      rrc_rlc_config_asn1_req(ctxt_pP,
+                              ue_context_p->ue_context.SRB_configList,
+                              (DRB_ToAddModList_t*) NULL,
+                              (DRB_ToReleaseList_t*) NULL
+#   if defined(Rel10) || defined(Rel14)
+                              , (PMCH_InfoList_r9_t *) NULL
+#   endif
+                             );
+#endif //NO_RRM
+      }
+      break;
+
+    case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest:
+      T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+#ifdef RRC_MSG_PRINT
+      LOG_F(RRC,"[MSG] RRC Connection Request\n");
+
+      for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) {
+        LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]);
+      }
+
+      LOG_F(RRC,"\n");
+#endif
+      LOG_D(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB --- MAC_DATA_IND  (rrcConnectionRequest on SRB0) --> RRC_eNB\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+      ue_context_p = rrc_eNB_get_ue_context(
+                       RC.rrc[ctxt_pP->module_id],
+                       ctxt_pP->rnti);
+
+      if (ue_context_p != NULL) {
+        // erase content
+        rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_p);
+
+        MSC_LOG_RX_DISCARDED_MESSAGE(
+          MSC_RRC_ENB,
+          MSC_RRC_UE,
+          Srb_info->Rx_buffer.Payload,
+          dec_rval.consumed,
+          MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (UE already in context)",
+          MSC_AS_TIME_ARGS(ctxt_pP),
+          ue_context_p->ue_context.rnti,
+          dec_rval.consumed);
+      } else {
+        rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8;
+        {
+          if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) {
+            AssertFatal(rrcConnectionRequest->ue_Identity.choice.randomValue.size == 5,
+                        "wrong InitialUE-Identity randomValue size, expected 5, provided %d",
+                        rrcConnectionRequest->ue_Identity.choice.randomValue.size);
+            memcpy(((uint8_t*) & random_value) + 3,
+                   rrcConnectionRequest->ue_Identity.choice.randomValue.buf,
+                   rrcConnectionRequest->ue_Identity.choice.randomValue.size);
+            /* if there is already a registered UE (with another RNTI) with this random_value,
+             * the current one must be removed from MAC/PHY (zombie UE)
+             */
+#if 0
+            if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) {
+              LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n",
+                    ctxt_pP->rnti, ue_context_p->ue_context.rnti, ctxt_pP->rnti);
+	      rrc_mac_remove_ue(ctxt_pP->module_id, ctxt_pP->rnti);
+              ue_context_p = NULL;
+              return 0;
+            } else {
+              ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value);
+            }
+#endif
+            if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) {
+              LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n",
+                    ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti);
+              ue_context_p->ue_context.ul_failure_timer = 20000;
+            }
+            ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value);
+          } else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) {
+            /* Save s-TMSI */
+            S_TMSI_t   s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI;
+            mme_code_t mme_code = BIT_STRING_to_uint8(&s_TMSI.mmec);
+            m_tmsi_t   m_tmsi   = BIT_STRING_to_uint32(&s_TMSI.m_TMSI);
+            random_value = (((uint64_t)mme_code) << 32) | m_tmsi;
+            if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) {
+	      LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti);
+	      rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti);
+	      stmsi_received=1;
+              /* replace rnti in the context */
+              /* for that, remove the context from the RB tree */
+              RB_REMOVE(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p);
+              /* and insert again, after changing rnti everywhere it has to be changed */
+              ue_context_p->ue_id_rnti = ctxt_pP->rnti;
+	      ue_context_p->ue_context.rnti = ctxt_pP->rnti;
+              RB_INSERT(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p);
+              /* reset timers */
+              ue_context_p->ue_context.ul_failure_timer = 0;
+              ue_context_p->ue_context.ue_release_timer = 0;
+              ue_context_p->ue_context.ue_reestablishment_timer = 0;
+              ue_context_p->ue_context.ue_release_timer_s1 = 0;
+              ue_context_p->ue_context.ue_release_timer_rrc = 0;
+            } else {
+	      LOG_I(RRC," S-TMSI doesn't exist, setting Initialue_identity_s_TMSI.m_tmsi to %p => %x\n",ue_context_p,m_tmsi);
+//              ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY);
+              ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP,random_value);
+              if (ue_context_p == NULL)
+                LOG_E(RRC, "%s:%d:%s: rrc_eNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__);
+              if (ue_context_p != NULL) {
+	        ue_context_p->ue_context.Initialue_identity_s_TMSI.presence = TRUE;
+	        ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = mme_code;
+	        ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi = m_tmsi;
+              } else {
+                /* TODO: do we have to break here? */
+                //break;
+              }
+            }
+
+            MSC_LOG_RX_MESSAGE(
+              MSC_RRC_ENB,
+              MSC_RRC_UE,
+              Srb_info->Rx_buffer.Payload,
+              dec_rval.consumed,
+              MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (s-TMSI mmec %u m_TMSI %u random UE id (0x%" PRIx64 ")",
+              MSC_AS_TIME_ARGS(ctxt_pP),
+              ue_context_p->ue_context.rnti,
+              dec_rval.consumed,
+              ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code,
+              ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
+              ue_context_p->ue_context.random_ue_identity);
+          } else {
+            LOG_E(RRC,
+                  PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest without random UE identity or S-TMSI not supported, let's reject the UE\n",
+                  PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+            rrc_eNB_generate_RRCConnectionReject(ctxt_pP,
+                             rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti),
+                             CC_id);
+            break;
+          }
+
+        }
+        LOG_D(RRC,
+              PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+              ue_context_p);
+
+        if (ue_context_p != NULL) {
+
+
+#if defined(ENABLE_ITTI)
+          ue_context_p->ue_context.establishment_cause = rrcConnectionRequest->establishmentCause;
+          ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1;
+	  if (stmsi_received==0)
+	    LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE random UE identity (0x%" PRIx64 ") MME code %u TMSI %u cause %ld\n",
+		  PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+		  ue_context_p->ue_context.random_ue_identity,
+		  ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code,
+		  ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
+		  ue_context_p->ue_context.establishment_cause);
+	  else
+	    LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE  MME code %u TMSI %u cause %ld\n",
+		  PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+		  ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code,
+		  ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
+		  ue_context_p->ue_context.establishment_cause);
+#else
+          LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection for UE random UE identity (0x%" PRIx64 ")\n",
+                PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+                ue_context_p->ue_context.random_ue_identity);
+#endif
+          if (stmsi_received == 0)
+	    RC.rrc[ctxt_pP->module_id]->Nb_ue++;
+
+        } else {
+          // no context available
+	  if (rrc_agent_registered[ctxt_pP->module_id]) {
+	    agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
+										      ctxt_pP->rnti,
+										      PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
+	  }
+          LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n",
+                PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+                random_value);
+	  rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti);
+          return -1;
+        }
+      }
+
+#ifndef NO_RRM
+      send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id));
+#else
+
+      ue_context_p->ue_context.primaryCC_id = CC_id;
+
+      //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH;
+      Idx = DCCH;
+      // SRB1
+      ue_context_p->ue_context.Srb1.Active = 1;
+      ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx;
+      memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0],
+             &DCCH_LCHAN_DESC,
+             LCHAN_DESC_SIZE);
+      memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1],
+             &DCCH_LCHAN_DESC,
+             LCHAN_DESC_SIZE);
+
+      // SRB2: set  it to go through SRB1 with id 1 (DCCH)
+      ue_context_p->ue_context.Srb2.Active = 1;
+      ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx;
+      memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0],
+             &DCCH_LCHAN_DESC,
+             LCHAN_DESC_SIZE);
+      memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1],
+             &DCCH_LCHAN_DESC,
+             LCHAN_DESC_SIZE);
+      
+      rrc_eNB_generate_RRCConnectionSetup(ctxt_pP, ue_context_p, CC_id);
+      LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            Idx);
+
+      MSC_LOG_TX_MESSAGE(
+        MSC_RRC_ENB,
+        MSC_PDCP_ENB,
+        NULL,
+        0,
+        MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB",
+        MSC_AS_TIME_ARGS(ctxt_pP),
+        ue_context_p->ue_context.rnti);
+
+      rrc_pdcp_config_asn1_req(ctxt_pP,
+                               ue_context_p->ue_context.SRB_configList,
+                               (DRB_ToAddModList_t *) NULL,
+                               (DRB_ToReleaseList_t*) NULL,
+                               0xff,
+                               NULL,
+                               NULL,
+                               NULL
+#   if defined(Rel10) || defined(Rel14)
+                               , (PMCH_InfoList_r9_t *) NULL
+#   endif
+                               ,NULL);
+
+      rrc_rlc_config_asn1_req(ctxt_pP,
+                              ue_context_p->ue_context.SRB_configList,
+                              (DRB_ToAddModList_t*) NULL,
+                              (DRB_ToReleaseList_t*) NULL
+#   if defined(Rel10) || defined(Rel14)
+                              , (PMCH_InfoList_r9_t *) NULL
+#   endif
+                             );
+#endif //NO_RRM
+
+      break;
+
+    default:
+      LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+      rval = -1;
+      break;
+    }
+
+    rval = 0;
+  } else {
+    LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT"  Unknown error \n",
+          PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+    rval = -1;
+  }
+
+  return rval;
+}
+
+//-----------------------------------------------------------------------------
+int
+rrc_eNB_decode_dcch(
+  const protocol_ctxt_t* const ctxt_pP,
+  const rb_id_t                Srb_id,
+  const uint8_t*    const      Rx_sdu,
+  const sdu_size_t             sdu_sizeP
+)
+//-----------------------------------------------------------------------------
+{
+
+  asn_dec_rval_t                      dec_rval;
+  //UL_DCCH_Message_t uldcchmsg;
+  UL_DCCH_Message_t                  *ul_dcch_msg = NULL; //&uldcchmsg;
+  int i;
+  struct rrc_eNB_ue_context_s*        ue_context_p = NULL;
+#if defined(ENABLE_ITTI)
+#   if defined(ENABLE_USE_MME)
+  MessageDef *                        msg_delete_tunnels_p = NULL;
+  uint8_t                             xid;
+#endif
+#endif
+
+  int dedicated_DRB=0; 
+
+  T(T_ENB_RRC_UL_DCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+    T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+  if ((Srb_id != 1) && (Srb_id != 2)) {
+    LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%d, should not have ...\n",
+          PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+          Srb_id);
+  } else {
+    LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%d\n",
+          PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+          Srb_id);
+  }
+  //memset(ul_dcch_msg,0,sizeof(UL_DCCH_Message_t));
+
+  LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL-DCCH Message\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+  dec_rval = uper_decode(
+               NULL,
+               &asn_DEF_UL_DCCH_Message,
+               (void**)&ul_dcch_msg,
+               Rx_sdu,
+               sdu_sizeP,
+               0,
+               0);
+  /*
+#if defined(ENABLE_ITTI)
+#   if defined(DISABLE_ITTI_XER_PRINT)
+  {
+    MessageDef                         *message_p;
+
+    message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_UL_DCCH_MESSAGE);
+    memcpy(&message_p->ittiMsg, (void *)ul_dcch_msg, sizeof(RrcUlDcchMessage));
+
+    itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p);
+  }
+#   else
+  {
+    char                                message_string[10000];
+    size_t                              message_string_size;
+
+    if ((message_string_size =
+           xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg)) >= 0) {
+      MessageDef                         *msg_p;
+
+      msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_DCCH, message_string_size + sizeof(IttiMsgText));
+      msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size;
+      memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size);
+
+      itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
+    }
+  }
+#   endif
+#endif
+  */
+  {
+    for (i = 0; i < sdu_sizeP; i++) {
+      LOG_T(RRC, "%x.", Rx_sdu[i]);
+    }
+
+    LOG_T(RRC, "\n");
+  }
+
+  if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
+    LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UL-DCCH (%zu bytes)\n",
+          PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+          dec_rval.consumed);
+    return -1;
+  }
+
+  ue_context_p = rrc_eNB_get_ue_context(
+                   RC.rrc[ctxt_pP->module_id],
+                   ctxt_pP->rnti);
+
+  if (ul_dcch_msg->message.present == UL_DCCH_MessageType_PR_c1) {
+
+    switch (ul_dcch_msg->message.choice.c1.present) {
+    case UL_DCCH_MessageType__c1_PR_NOTHING:   /* No components present */
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_csfbParametersRequestCDMA2000:
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_measurementReport:
+      LOG_D(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND "
+            "%d bytes (measurementReport) ---> RRC_eNB\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            DCCH,
+            sdu_sizeP);
+      rrc_eNB_process_MeasurementReport(
+        ctxt_pP,
+        ue_context_p,
+        &ul_dcch_msg->message.choice.c1.choice.measurementReport.
+        criticalExtensions.choice.c1.choice.measurementReport_r8.measResults);
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete:
+#ifdef RRC_MSG_PRINT
+      LOG_F(RRC,"[MSG] RRC Connection Reconfiguration Complete\n");
+
+      for (i = 0; i < sdu_sizeP; i++) {
+        LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
+      }
+
+      LOG_F(RRC,"\n");
+#endif
+      MSC_LOG_RX_MESSAGE(
+        MSC_RRC_ENB,
+        MSC_RRC_UE,
+        Rx_sdu,
+        sdu_sizeP,
+        MSC_AS_TIME_FMT" RRCConnectionReconfigurationComplete UE %x size %u",
+        MSC_AS_TIME_ARGS(ctxt_pP),
+        ue_context_p->ue_context.rnti,
+        sdu_sizeP);
+
+      LOG_D(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
+            "(RRCConnectionReconfigurationComplete) ---> RRC_eNB]\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            DCCH,
+            sdu_sizeP);
+
+      if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.
+          present ==
+          RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) {
+	/*NN: revise the condition */
+        if (ue_context_p->ue_context.Status == RRC_RECONFIGURED){
+	  dedicated_DRB = 1;
+	  LOG_I(RRC,
+		PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n",
+		PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
+	}else {
+	  dedicated_DRB = 0;
+	  ue_context_p->ue_context.Status = RRC_RECONFIGURED;
+	  LOG_I(RRC,
+		PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n",
+		PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
+	}
+	rrc_eNB_process_RRCConnectionReconfigurationComplete(
+          ctxt_pP,
+          ue_context_p,
+	  ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
+
+	//WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
+	if (rrc_agent_registered[ctxt_pP->module_id]) {
+	  agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
+										ue_context_p->ue_id_rnti,
+										PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED);
+	}
+      }
+#if defined(ENABLE_ITTI)
+#   if defined(ENABLE_USE_MME)
+      if (EPC_MODE_ENABLED == 1) {
+	if (dedicated_DRB == 1){
+//	  rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP,
+//					     ue_context_p,
+//					     ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
+if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
+            rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(ctxt_pP,
+                             ue_context_p,
+                             ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
+
+            ue_context_p->ue_context.nb_of_modify_e_rabs = 0;
+            ue_context_p->ue_context.nb_of_failed_e_rabs = 0;
+            memset(ue_context_p->ue_context.modify_e_rab, 0, sizeof(ue_context_p->ue_context.modify_e_rab));
+            for(int i = 0; i < NB_RB_MAX; i++) {
+              ue_context_p->ue_context.modify_e_rab[i].xid = -1;
+            }
+
+          } else if(ue_context_p->ue_context.e_rab_release_command_flag == 1){
+            xid = ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier;
+            ue_context_p->ue_context.e_rab_release_command_flag = 0;
+            //gtp tunnel delete
+            msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ);
+            memset(&GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p)));
+            GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti;
+            for(i = 0; i < NB_RB_MAX; i++){
+               if(xid == ue_context_p->ue_context.e_rab[i].xid){
+                 GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i];
+                 ue_context_p->ue_context.enb_gtp_teid[i] = 0;
+                 memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i]));
+                 ue_context_p->ue_context.enb_gtp_ebi[i]  = 0;
+               }
+            }
+            itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->instance, msg_delete_tunnels_p);
+            //S1AP_E_RAB_RELEASE_RESPONSE
+            rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(ctxt_pP,
+                    ue_context_p,
+                    xid);
+          } else {
+              rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP,
+                             ue_context_p,
+                             ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
+          }
+	}else {
+          if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){
+	    rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP,
+						       ue_context_p);
+          } else {
+            ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1;
+            for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) {
+              if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) {
+                ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED;
+              } else {
+                ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED;
+              }
+            }
+          }
+	}
+      }    
+#else  // establish a dedicated bearer 
+      if (dedicated_DRB == 0 ) {
+	//	ue_context_p->ue_context.e_rab[0].status = E_RAB_STATUS_ESTABLISHED;
+	rrc_eNB_reconfigure_DRBs(ctxt_pP,ue_context_p);
+      }
+      
+#endif
+#endif 
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete:
+      T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+#ifdef RRC_MSG_PRINT
+      LOG_F(RRC,"[MSG] RRC Connection Reestablishment Complete\n");
+
+      for (i = 0; i < sdu_sizeP; i++) {
+        LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
+      }
+
+      LOG_F(RRC,"\n");
+#endif
+
+      MSC_LOG_RX_MESSAGE(
+        MSC_RRC_ENB,
+        MSC_RRC_UE,
+        Rx_sdu,
+        sdu_sizeP,
+        MSC_AS_TIME_FMT" rrcConnectionReestablishmentComplete UE %x size %u",
+        MSC_AS_TIME_ARGS(ctxt_pP),
+        ue_context_p->ue_context.rnti,
+        sdu_sizeP);
+
+      LOG_I(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
+            "(rrcConnectionReestablishmentComplete) ---> RRC_eNB\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            DCCH,
+            sdu_sizeP);
+       {
+        int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti);
+        RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0;
+        rnti_t reestablish_rnti = 0;
+        // select C-RNTI from map
+        for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
+          if (reestablish_rnti_map[i][0] == ctxt_pP->rnti) {
+            reestablish_rnti = reestablish_rnti_map[i][1];
+            ue_context_p = rrc_eNB_get_ue_context(
+                              RC.rrc[ctxt_pP->module_id],
+                              reestablish_rnti);
+            // clear currentC-RNTI from map
+            reestablish_rnti_map[i][0] = 0;
+            reestablish_rnti_map[i][1] = 0;
+            break;
+          }
+        }
+        LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n",
+              i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]);
+
+        if (!ue_context_p) {
+          LOG_E(RRC,
+                PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentComplete without UE context, falt\n",
+                PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+          break;
+        }
+
+        if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.present ==
+            RRCConnectionReestablishmentComplete__criticalExtensions_PR_rrcConnectionReestablishmentComplete_r8) {
+          rrc_eNB_process_RRCConnectionReestablishmentComplete(ctxt_pP, reestablish_rnti, ue_context_p,
+              ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.rrc_TransactionIdentifier,
+              &ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8);
+
+          //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
+          if (mac_agent_registered[ctxt_pP->module_id]) {
+            agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
+                                                                                      ue_context_p->ue_id_rnti,
+                                                                                      PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED);
+          }
+        }
+        //ue_context_p->ue_context.ue_release_timer = 0;
+        ue_context_p->ue_context.ue_reestablishment_timer = 1;
+        // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered
+        ue_context_p->ue_context.ue_reestablishment_timer_thres = 1000;
+      }
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete:
+#ifdef RRC_MSG_PRINT
+      LOG_F(RRC,"[MSG] RRC Connection SetupComplete\n");
+
+      for (i = 0; i < sdu_sizeP; i++) {
+        LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
+      }
+
+      LOG_F(RRC,"\n");
+#endif
+
+      MSC_LOG_RX_MESSAGE(
+        MSC_RRC_ENB,
+        MSC_RRC_UE,
+        Rx_sdu,
+        sdu_sizeP,
+        MSC_AS_TIME_FMT" RRCConnectionSetupComplete UE %x size %u",
+        MSC_AS_TIME_ARGS(ctxt_pP),
+        ue_context_p->ue_context.rnti,
+        sdu_sizeP);
+
+      LOG_D(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
+            "(RRCConnectionSetupComplete) ---> RRC_eNB\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            DCCH,
+            sdu_sizeP);
+
+      if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.present ==
+          RRCConnectionSetupComplete__criticalExtensions_PR_c1) {
+        if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.
+            present ==
+            RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) {
+          rrc_eNB_process_RRCConnectionSetupComplete(
+            ctxt_pP,
+            ue_context_p,
+            &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8);
+          ue_context_p->ue_context.Status = RRC_CONNECTED;
+          LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n",
+                PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+	  
+	  //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
+	  if (rrc_agent_registered[ctxt_pP->module_id]) {
+	    agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
+										  ue_context_p->ue_id_rnti,
+										  PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED);
+	  }
+        }
+      }
+
+      ue_context_p->ue_context.ue_release_timer=0;
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_securityModeComplete:
+      T(T_ENB_RRC_SECURITY_MODE_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+#ifdef RRC_MSG_PRINT
+      LOG_F(RRC,"[MSG] RRC Security Mode Complete\n");
+
+      for (i = 0; i < sdu_sizeP; i++) eNB->pusch_vars[UE_id]{
+        LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
+      }
+
+      LOG_F(RRC,"\n");
+#endif
+
+      MSC_LOG_RX_MESSAGE(
+        MSC_RRC_ENB,
+        MSC_RRC_UE,
+        Rx_sdu,
+        sdu_sizeP,
+        MSC_AS_TIME_FMT" securityModeComplete UE %x size %u",
+        MSC_AS_TIME_ARGS(ctxt_pP),
+        ue_context_p->ue_context.rnti,
+        sdu_sizeP);
+
+      LOG_I(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            DCCH);
+      LOG_D(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
+            "(securityModeComplete) ---> RRC_eNB\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            DCCH,
+            sdu_sizeP);
+#ifdef XER_PRINT
+      xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg);
+#endif
+      // confirm with PDCP about the security mode for DCCH
+      //rrc_pdcp_config_req (enb_mod_idP, frameP, 1,CONFIG_ACTION_SET_SECURITY_MODE, (ue_mod_idP * NB_RB_MAX) + DCCH, 0x77);
+      // continue the procedure
+      rrc_eNB_generate_UECapabilityEnquiry(
+        ctxt_pP,
+        ue_context_p);
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_securityModeFailure:
+      T(T_ENB_RRC_SECURITY_MODE_FAILURE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+#ifdef RRC_MSG_PRINT
+      LOG_F(RRC,"[MSG] RRC Security Mode Failure\n");
+
+      for (i = 0; i < sdu_sizeP; i++) {
+        LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
+      }
+
+      LOG_F(RRC,"\n");
+#endif
+
+      MSC_LOG_RX_MESSAGE(
+        MSC_RRC_ENB,
+        MSC_RRC_UE,
+        Rx_sdu,
+        sdu_sizeP,
+        MSC_AS_TIME_FMT" securityModeFailure UE %x size %u",
+        MSC_AS_TIME_ARGS(ctxt_pP),
+        ue_context_p->ue_context.rnti,
+        sdu_sizeP);
+
+      LOG_W(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
+            "(securityModeFailure) ---> RRC_eNB\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            DCCH,
+            sdu_sizeP);
+#ifdef XER_PRINT
+      xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg);
+#endif
+      // cancel the security mode in PDCP
+
+      // followup with the remaining procedure
+//#warning "LG Removed rrc_eNB_generate_UECapabilityEnquiry after receiving securityModeFailure"
+      rrc_eNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p);
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation:
+      T(T_ENB_RRC_UE_CAPABILITY_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+#ifdef RRC_MSG_PRINT
+      LOG_F(RRC,"[MSG] RRC UECapablility Information \n");
+
+      for (i = 0; i < sdu_sizeP; i++) {
+        LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
+      }
+
+      LOG_F(RRC,"\n");
+#endif
+
+      MSC_LOG_RX_MESSAGE(
+        MSC_RRC_ENB,
+        MSC_RRC_UE,
+        Rx_sdu,
+        sdu_sizeP,
+        MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u",
+        MSC_AS_TIME_ARGS(ctxt_pP),
+        ue_context_p->ue_context.rnti,
+        sdu_sizeP);
+
+      LOG_I(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            DCCH);
+      LOG_D(RRC,
+            PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
+            "(UECapabilityInformation) ---> RRC_eNB\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            DCCH,
+            sdu_sizeP);
+#ifdef XER_PRINT
+      xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg);
+#endif
+      LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti);
+      if (ue_context_p->ue_context.UE_Capability) {
+        LOG_I(RRC, "freeing old UE capabilities for UE %x\n", ctxt_pP->rnti);
+        asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability,
+              ue_context_p->ue_context.UE_Capability, 0);
+        ue_context_p->ue_context.UE_Capability = 0;
+      }
+      dec_rval = uper_decode(NULL,
+                             &asn_DEF_UE_EUTRA_Capability,
+                             (void **)&ue_context_p->ue_context.UE_Capability,
+                             ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.
+                             choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.
+                             array[0]->ueCapabilityRAT_Container.buf,
+                             ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.
+                             choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.
+                             array[0]->ueCapabilityRAT_Container.size, 0, 0);
+#ifdef XER_PRINT
+      xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability);
+#endif
+
+      if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
+        LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UE capabilities (%zu bytes)\n",
+              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+              dec_rval.consumed);
+        asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability,
+              ue_context_p->ue_context.UE_Capability, 0);
+        ue_context_p->ue_context.UE_Capability = 0;
+      }
+
+#if defined(ENABLE_USE_MME)
+
+      if (EPC_MODE_ENABLED == 1) {
+        rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP,
+                                              ue_context_p,
+                                              ul_dcch_msg);
+      }
+#else 
+      ue_context_p->ue_context.nb_of_e_rabs = 1;
+      for (i = 0; i < ue_context_p->ue_context.nb_of_e_rabs; i++){
+	ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW;
+	ue_context_p->ue_context.e_rab[i].param.e_rab_id = 1+i;
+	ue_context_p->ue_context.e_rab[i].param.qos.qci=9;
+      }
+      ue_context_p->ue_context.setup_e_rabs =ue_context_p->ue_context.nb_of_e_rabs;
+#endif
+
+      rrc_eNB_generate_defaultRRCConnectionReconfiguration(ctxt_pP,
+          ue_context_p,
+          RC.rrc[ctxt_pP->module_id]->HO_flag);
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer:
+      T(T_ENB_RRC_UL_HANDOVER_PREPARATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_ulInformationTransfer:
+      T(T_ENB_RRC_UL_INFORMATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+      LOG_D(RRC,"[MSG] RRC UL Information Transfer \n");
+#ifdef RRC_MSG_PRINT
+      LOG_F(RRC,"[MSG] RRC UL Information Transfer \n");
+
+      for (i = 0; i < sdu_sizeP; i++) {
+        LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
+      }
+
+      LOG_F(RRC,"\n");
+#endif
+
+
+      MSC_LOG_RX_MESSAGE(
+        MSC_RRC_ENB,
+        MSC_RRC_UE,
+        Rx_sdu,
+        sdu_sizeP,
+        MSC_AS_TIME_FMT" ulInformationTransfer UE %x size %u",
+        MSC_AS_TIME_ARGS(ctxt_pP),
+        ue_context_p->ue_context.rnti,
+        sdu_sizeP);
+
+#if defined(ENABLE_USE_MME)
+
+      if (EPC_MODE_ENABLED == 1) {
+        rrc_eNB_send_S1AP_UPLINK_NAS(ctxt_pP,
+                                     ue_context_p,
+                                     ul_dcch_msg);
+      }
+
+#endif
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_counterCheckResponse:
+      T(T_ENB_RRC_COUNTER_CHECK_RESPONSE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+      break;
+
+#if defined(Rel10) || defined(Rel14)
+
+    case UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9:
+      T(T_ENB_RRC_UE_INFORMATION_RESPONSE_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_proximityIndication_r9:
+      T(T_ENB_RRC_PROXIMITY_INDICATION_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10:
+      T(T_ENB_RRC_RECONFIGURATION_COMPLETE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10:
+      T(T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+      break;
+
+    case UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10:
+      T(T_ENB_RRC_INTER_FREQ_RSTD_MEASUREMENT_INDICATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+      break;
+#endif
+
+    default:
+      T(T_ENB_RRC_UNKNOW_MESSAGE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
+        T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
+
+      LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message %s:%u\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+            __FILE__, __LINE__);
+      return -1;
+    }
+
+    return 0;
+  } else {
+    LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown error %s:%u\n",
+          PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+          __FILE__, __LINE__);
+    return -1;
+  }
+
+}
+
+#if defined(ENABLE_ITTI)
+void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t* const ctxt_pP,
+			       rrc_eNB_ue_context_t*  ue_context_pP){
+
+  int i;
+  int e_rab_done=0;
+  for (i = 0; 
+       i < 3;//NB_RB_MAX - 3;  // S1AP_MAX_E_RAB
+       i++) {
+    
+    if ( ue_context_pP->ue_context.e_rab[i].status < E_RAB_STATUS_DONE){ 
+      ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_NEW;
+      ue_context_pP->ue_context.e_rab[i].param.e_rab_id = i + 1;
+      ue_context_pP->ue_context.e_rab[i].param.qos.qci = i % 9;
+      ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.priority_level= i % PRIORITY_LEVEL_LOWEST;
+      ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_capability= PRE_EMPTION_CAPABILITY_DISABLED;
+      ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_vulnerability= PRE_EMPTION_VULNERABILITY_DISABLED;
+      ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL;
+      ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length = 0;
+      //	memset (ue_context_pP->ue_context.e_rab[i].param.sgw_addr.buffer,0,20);
+      ue_context_pP->ue_context.e_rab[i].param.sgw_addr.length = 0;
+      ue_context_pP->ue_context.e_rab[i].param.gtp_teid=0;
+      
+      ue_context_pP->ue_context.nb_of_e_rabs++;
+      e_rab_done++;
+      LOG_I(RRC,"setting up the dedicated DRBs %d (index %d) status %d \n", 
+	    ue_context_pP->ue_context.e_rab[i].param.e_rab_id, i, ue_context_pP->ue_context.e_rab[i].status);
+    }
+  }
+  ue_context_pP->ue_context.setup_e_rabs+=e_rab_done;
+ 
+  rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(ctxt_pP, ue_context_pP, 0);
+}
+
+
+//-----------------------------------------------------------------------------
+void*
+rrc_enb_task(
+  void* args_p
+)
+//-----------------------------------------------------------------------------
+{
+  MessageDef                         *msg_p;
+  const char                         *msg_name_p;
+  instance_t                          instance;
+  int                                 result;
+  SRB_INFO                           *srb_info_p;
+  int                                 CC_id;
+
+  protocol_ctxt_t                     ctxt;
+  itti_mark_task_ready(TASK_RRC_ENB);
+  LOG_I(RRC,"Entering main loop of RRC message task\n");
+  while (1) {
+    // Wait for a message
+    itti_receive_msg(TASK_RRC_ENB, &msg_p);
+
+    msg_name_p = ITTI_MSG_NAME(msg_p);
+    instance = ITTI_MSG_INSTANCE(msg_p);
+    LOG_I(RRC,"Received message %s\n",msg_name_p);
+
+    switch (ITTI_MSG_ID(msg_p)) {
+    case TERMINATE_MESSAGE:
+      LOG_W(RRC, " *** Exiting RRC thread\n");
+      itti_exit_task();
+      break;
+
+    case MESSAGE_TEST:
+      LOG_I(RRC, "[eNB %d] Received %s\n", instance, msg_name_p);
+      break;
+
+      /* Messages from MAC */
+    case RRC_MAC_CCCH_DATA_IND:
+      PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
+                                    instance,
+                                    ENB_FLAG_YES,
+                                    RRC_MAC_CCCH_DATA_IND(msg_p).rnti,
+                                    msg_p->ittiMsgHeader.lte_time.frame,
+                                    msg_p->ittiMsgHeader.lte_time.slot);
+      LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received %s\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt),
+            msg_name_p);
+
+      CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id;
+      srb_info_p = &RC.rrc[instance]->carrier[CC_id].Srb0;
+
+      LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n",
+	    instance,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
+      AssertFatal(RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size < RRC_BUFFER_SIZE_MAX,
+		  "CCCH message has size %d > %d\n",
+		  RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX);
+      memcpy(srb_info_p->Rx_buffer.Payload,
+             RRC_MAC_CCCH_DATA_IND(msg_p).sdu,
+             RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
+      srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size;
+
+      rrc_eNB_decode_ccch(&ctxt, srb_info_p, CC_id);
+      break;
+	    
+      /* Messages from PDCP */
+    case RRC_DCCH_DATA_IND:
+      PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
+                                    instance,
+                                    ENB_FLAG_YES,
+                                    RRC_DCCH_DATA_IND(msg_p).rnti,
+                                    msg_p->ittiMsgHeader.lte_time.frame,
+                                    msg_p->ittiMsgHeader.lte_time.slot);
+      LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received on DCCH %d %s\n",
+            PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt),
+            RRC_DCCH_DATA_IND(msg_p).dcch_index,
+            msg_name_p);
+      rrc_eNB_decode_dcch(&ctxt,
+                          RRC_DCCH_DATA_IND(msg_p).dcch_index,
+                          RRC_DCCH_DATA_IND(msg_p).sdu_p,
+                          RRC_DCCH_DATA_IND(msg_p).sdu_size);
+
+      // Message buffer has been processed, free it now.
+      result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND(msg_p).sdu_p);
+      AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
+      break;
+
+#   if defined(ENABLE_USE_MME)
+
+      /* Messages from S1AP */
+    case S1AP_DOWNLINK_NAS:
+      rrc_eNB_process_S1AP_DOWNLINK_NAS(msg_p, msg_name_p, instance, &rrc_eNB_mui);
+      break;
+
+    case S1AP_INITIAL_CONTEXT_SETUP_REQ:
+      rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p, msg_name_p, instance);
+      break;
+
+    case S1AP_UE_CTXT_MODIFICATION_REQ:
+      rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(msg_p, msg_name_p, instance);
+      break;
+
+    case S1AP_PAGING_IND:
+      LOG_D(RRC, "[eNB %d] Received Paging message from S1AP: %s\n", instance, msg_name_p);
+      rrc_eNB_process_PAGING_IND(msg_p, msg_name_p, instance);
+      break;
+  
+    case S1AP_E_RAB_SETUP_REQ: 
+      rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(msg_p, msg_name_p, instance);
+      LOG_D(RRC, "[eNB %d] Received the message %s\n", instance, msg_name_p);
+      break;
+
+    case S1AP_E_RAB_MODIFY_REQ:
+      rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(msg_p, msg_name_p, instance);
+      break;
+
+    case S1AP_E_RAB_RELEASE_COMMAND:
+      rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(msg_p, msg_name_p, instance);
+      break;
+    
+    case S1AP_UE_CONTEXT_RELEASE_REQ:
+      rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance);
+      break;
+
+    case S1AP_UE_CONTEXT_RELEASE_COMMAND:
+      rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND(msg_p, msg_name_p, instance);
+      break;
+
+    case GTPV1U_ENB_DELETE_TUNNEL_RESP:
+      /* Nothing to do. Apparently everything is done in S1AP processing */
+      //LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n",
+      //instance, msg_name_p);
+      if (rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)
+          && rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) {
+        rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc =
+        rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc;
+      }
+      break;
+
+#   endif
+
+      /* Messages from eNB app */
+    case RRC_CONFIGURATION_REQ:
+      LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p,&RRC_CONFIGURATION_REQ(msg_p));
+      openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_CONFIGURATION_REQ(msg_p));
+      break;
+
+    default:
+      LOG_E(RRC, "[eNB %d] Received unexpected message %s\n", instance, msg_name_p);
+      break;
+    }
+
+    result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
+    AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
+    msg_p = NULL;
+  }
+}
+#endif
+
+/*------------------------------------------------------------------------------*/
+void
+openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active)
+//-----------------------------------------------------------------------------
+{
+
+  module_id_t         module_id;
+  int                 CC_id;
+
+  /* for no gcc warnings */
+  (void)CC_id;
+
+  LOG_D(RRC, "[OPENAIR][INIT] Init function start: NB_eNB_INST=%d\n", RC.nb_inst);
+
+  if (RC.nb_inst > 0) {
+    LOG_I(RRC,"[eNB] handover active state is %d \n", HO_active);
+
+    for (module_id=0; module_id<NB_eNB_INST; module_id++) {
+      RC.rrc[module_id]->HO_flag   = (uint8_t)HO_active;
+    }
+
+#if defined(Rel10) || defined(Rel14)
+    LOG_I(RRC,"[eNB] eMBMS active state is %d \n", eMBMS_active);
+
+    for (module_id=0; module_id<NB_eNB_INST; module_id++) {
+      for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+        RC.rrc[module_id]->carrier[CC_id].MBMS_flag = (uint8_t)eMBMS_active;
+      }
+    }
+
+#endif
+#ifdef CBA
+
+    for (module_id=0; module_id<RC.nb_inst; module_id++) {
+      for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+        RC.rrc[module_id]->carrier[CC_id].num_active_cba_groups = cba_group_active;
+      }
+    }
+
+#endif
+  } 
+
+
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_top_cleanup_eNB(
+  void
+)
+//-----------------------------------------------------------------------------
+{
+
+  for (int i=0;i<RC.nb_inst;i++) free (RC.rrc[i]);
+  free(RC.rrc);
+}
+
+
+//-----------------------------------------------------------------------------
+RRC_status_t
+rrc_rx_tx(
+  protocol_ctxt_t* const ctxt_pP,
+  const int          CC_id
+)
+//-----------------------------------------------------------------------------
+{
+  //uint8_t        UE_id;
+  int32_t        current_timestamp_ms, ref_timestamp_ms;
+  struct timeval ts;
+  struct rrc_eNB_ue_context_s   *ue_context_p = NULL,*ue_to_be_removed = NULL;
+
+#ifdef LOCALIZATION
+  double                         estimated_distance;
+  protocol_ctxt_t                ctxt;
+#endif
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN);
+
+    check_handovers(ctxt_pP);
+    // counetr, and get the value and aggregate
+
+    // check for UL failure
+    RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
+      if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) {
+	if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
+	  LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/8\n",
+		ue_context_p->ue_context.rnti,
+		ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
+		ue_context_p->ue_context.ul_failure_timer);
+	}
+	else {
+	  LOG_I(RRC,"UE rnti %x failure timer %d/8\n",
+		ue_context_p->ue_context.rnti,
+		ue_context_p->ue_context.ul_failure_timer);
+	}
+      }
+      if (ue_context_p->ue_context.ul_failure_timer>0) {
+	ue_context_p->ue_context.ul_failure_timer++;
+	if (ue_context_p->ue_context.ul_failure_timer >= 8) {
+	  // remove UE after 20 seconds after MAC has indicated UL failure
+	  LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
+	  ue_to_be_removed = ue_context_p;
+	  break;
+	}
+      }
+      if (ue_context_p->ue_context.ue_release_timer_s1>0) {
+        ue_context_p->ue_context.ue_release_timer_s1++;
+        if (ue_context_p->ue_context.ue_release_timer_s1 >=
+            ue_context_p->ue_context.ue_release_timer_thres_s1) {
+          LOG_I(RRC,"Removing UE %x instance Because of UE_CONTEXT_RELEASE_COMMAND not received after %d ms from sending request\n",
+                         ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer_thres_s1);
+          ue_to_be_removed = ue_context_p;
+          break;
+        }
+      }
+
+      if (ue_context_p->ue_context.ue_release_timer_rrc>0) {
+        ue_context_p->ue_context.ue_release_timer_rrc++;
+        if (ue_context_p->ue_context.ue_release_timer_rrc >=
+          ue_context_p->ue_context.ue_release_timer_thres_rrc) {
+          LOG_I(RRC,"Removing UE %x instance After UE_CONTEXT_RELEASE_Complete\n", ue_context_p->ue_context.rnti);
+          ue_to_be_removed = ue_context_p;
+          break;
+        }
+      }
+
+      if (ue_context_p->ue_context.ue_reestablishment_timer>0) {
+        ue_context_p->ue_context.ue_reestablishment_timer++;
+        if (ue_context_p->ue_context.ue_reestablishment_timer >=
+            ue_context_p->ue_context.ue_reestablishment_timer_thres) {
+          LOG_I(RRC,"UE %d reestablishment_timer max\n",ue_context_p->ue_context.rnti);
+          ue_context_p->ue_context.ul_failure_timer = 20000;
+          ue_to_be_removed = ue_context_p;
+          ue_context_p->ue_context.ue_reestablishment_timer = 0;
+          break;
+        }
+      }
+      if (ue_context_p->ue_context.ue_release_timer>0) {
+	ue_context_p->ue_context.ue_release_timer++;
+	if (ue_context_p->ue_context.ue_release_timer >= 
+	    ue_context_p->ue_context.ue_release_timer_thres) {
+	  LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
+	  ue_to_be_removed = ue_context_p;
+	  break;
+	}
+      }
+    }
+    if (ue_to_be_removed) {
+      if(ue_to_be_removed->ue_context.ul_failure_timer >= 8) {
+          ue_to_be_removed->ue_context.ue_release_timer_s1 = 1;
+          ue_to_be_removed->ue_context.ue_release_timer_thres_s1 = 100;
+          ue_to_be_removed->ue_context.ue_release_timer = 0;
+          ue_to_be_removed->ue_context.ue_reestablishment_timer = 0;
+      }
+      rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed);
+      if(ue_to_be_removed->ue_context.ul_failure_timer >= 8){
+        ue_to_be_removed->ue_context.ul_failure_timer = 0;
+      }
+    }
+
+#ifdef RRC_LOCALIZATION
+
+    /* for the localization, only primary CC_id might be relevant*/
+    gettimeofday(&ts, NULL);
+    current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
+    ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms;
+    RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
+      ctxt = *ctxt_pP;
+      ctxt.rnti = ue_context_p->ue_context.rnti;
+      estimated_distance = rrc_get_estimated_ue_distance(
+                             &ctxt,
+                             CC_id,
+                             RC.rrc[ctxt_pP->module_id]->loc_type);
+
+      if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) &&
+          estimated_distance != -1) {
+        LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n",
+              ctxt.rnti,
+              ctxt_pP->module_id,
+              current_timestamp_ms,
+              ctxt_pP->frame,
+              estimated_distance);
+        LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.Status);
+        push_front(&RC.rrc[ctxt_pP->module_id]->loc_list,
+                   estimated_distance);
+        RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms;
+      }
+    }
+
+#endif
+    (void)ts; /* remove gcc warning "unused variable" */
+    (void)ref_timestamp_ms; /* remove gcc warning "unused variable" */
+    (void)current_timestamp_ms; /* remove gcc warning "unused variable" */
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+  return (RRC_OK);
+}
+
diff --git a/openair2/RRC/NR/rrc_types_NR.h b/openair2/RRC/NR/rrc_types_NR.h
new file mode 100644
index 0000000000000000000000000000000000000000..f621d9b2dd05e7cd54d65200c0f157068fceb8a1
--- /dev/null
+++ b/openair2/RRC/NR/rrc_types_NR.h
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file rrc_types.h
+* \brief rrc types and subtypes
+* \author Navid Nikaein and Raymond Knopp
+* \date 2011 - 2014, 2018
+* \version 1.0
+* \company Eurecom
+* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr
+*/
+
+#ifndef RRC_TYPES_NR_H_
+#define RRC_TYPES_NR_H_
+
+typedef enum Rrc_State_NR_e {
+  RRC_STATE_INACTIVE_NR=0,
+  RRC_STATE_IDLE_NR,
+  RRC_STATE_CONNECTED_NR,
+
+  RRC_STATE_FIRST_NR = RRC_STATE_INACTIVE_NR,
+  RRC_STATE_LAST_NR = RRC_STATE_CONNECTED_NR,
+} Rrc_State_NR_t;
+
+typedef enum Rrc_Sub_State_NR_e {
+  RRC_SUB_STATE_INACTIVE_NR=0,
+
+  RRC_SUB_STATE_IDLE_SEARCHING_NR,
+  RRC_SUB_STATE_IDLE_RECEIVING_SIB_NR,
+  RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR,
+  RRC_SUB_STATE_IDLE_CONNECTING_NR,
+  RRC_SUB_STATE_IDLE_NR,
+
+  RRC_SUB_STATE_CONNECTED_NR,
+
+  RRC_SUB_STATE_INACTIVE_FIRST_NB_IoT = RRC_SUB_STATE_INACTIVE_NR,
+  RRC_SUB_STATE_INACTIVE_LAST_NB_IoT = RRC_SUB_STATE_INACTIVE_NR,
+
+  RRC_SUB_STATE_IDLE_FIRST_NB_IoT = RRC_SUB_STATE_IDLE_SEARCHING_NR,
+  RRC_SUB_STATE_IDLE_LAST_NB_IoT = RRC_SUB_STATE_IDLE_NR,
+
+  RRC_SUB_STATE_CONNECTED_FIRST_NB_IoT = RRC_SUB_STATE_CONNECTED_NR,
+  RRC_SUB_STATE_CONNECTED_LAST_NB_IoT = RRC_SUB_STATE_CONNECTED_NR,
+} Rrc_Sub_State_NR_t;
+
+#endif /* RRC_TYPES_H_ */