diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2f2d95d4b7f748bfa2fe022162d5b867471b04a6..aa11892fa6a90593c848a84833f861dd7025fd80 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,6 +8,8 @@ job1:
    - echo $EXTERNAL_SHARE_DIR
    - echo $SHELL
    - echo $OAI_TEST_CASE_GROUP
+   - echo $MACHINELIST
+   - echo $MACHINELISTGENERIC
    - git rev-parse --abbrev-ref HEAD
    - git_repo=`git config --get remote.origin.url`
    - git_head=`git rev-parse HEAD`
@@ -25,13 +27,11 @@ job1:
    - echo $NRUNS_LTE_SOFTMODEM
    - echo $TIMEOUT_CMD
    - mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log
-   - python $OPENAIR_DIR/cmake_targets/autotests/run_exec_lte-softmodem_tests.py -c -5GRepo $git_repo -5GRepoHeadVersion $git_head -n $NFS_SHARE_DIR -u $OAI_USER -p $OAI_PASS  $OAI_EXTRA_ARGS -g "$OAI_TEST_CASE_GROUP">& $OPENAIR_DIR/cmake_targets/autotests/python_autotest_cleanup.log
-   - python $OPENAIR_DIR/cmake_targets/autotests/run_exec_lte-softmodem_tests.py -r -5GRepo $git_repo -5GRepoHeadVersion $git_head -n $NFS_SHARE_DIR -u $OAI_USER -p $OAI_PASS `echo $OAI_EXTRA_ARGS` -g "$OAI_TEST_CASE_GROUP" --nrun_lte_softmodem $NRUNS_LTE_SOFTMODEM --timeout_cmd $TIMEOUT_CMD >& $OPENAIR_DIR/cmake_targets/autotests/python_autotest.log
+   - python $OPENAIR_DIR/cmake_targets/autotests/run_exec_lte-softmodem_tests.py -c -5GRepo $git_repo -MachineList "$MACHINELIST" -MachineListGeneric "$MACHINELISTGENERIC"  -5GRepoHeadVersion $git_head -n $NFS_SHARE_DIR -u $OAI_USER -p $OAI_PASS  $OAI_EXTRA_ARGS -g "$OAI_TEST_CASE_GROUP">& $OPENAIR_DIR/cmake_targets/autotests/python_autotest_cleanup.log
+   - python $OPENAIR_DIR/cmake_targets/autotests/run_exec_lte-softmodem_tests.py -r -5GRepo $git_repo -MachineList "$MACHINELIST" -MachineListGeneric "$MACHINELISTGENERIC" -5GRepoHeadVersion $git_head -n $NFS_SHARE_DIR -u $OAI_USER -p $OAI_PASS `echo $OAI_EXTRA_ARGS` -g "$OAI_TEST_CASE_GROUP" --nrun_lte_softmodem $NRUNS_LTE_SOFTMODEM --timeout_cmd $TIMEOUT_CMD >& $OPENAIR_DIR/cmake_targets/autotests/python_autotest.log
    - mv $OPENAIR_DIR/cmake_targets/autotests/python_autotest.log $OPENAIR_DIR/cmake_targets/autotests/log/python_autotest.log
    - mv $OPENAIR_DIR/cmake_targets/autotests/python_autotest_cleanup.log $OPENAIR_DIR/cmake_targets/autotests/log/python_autotest_cleanup.log
    - sshpass -p "$OAI_PASS" rsync -az -e "ssh -o StrictHostKeyChecking=no "  --rsync-path="mkdir -p $NFS_TEST_RESULTS_DIR && rsync" $OPENAIR_DIR/cmake_targets/autotests/log $OAI_USER@localhost:$NFS_TEST_RESULTS_DIR
    - sshpass -p "$OAI_PASS" rsync -az -e "ssh -o StrictHostKeyChecking=no "  --rsync-path="mkdir -p $EXTERNAL_SHARE_DIR && rsync" $OPENAIR_DIR/cmake_targets/autotests/log $OAI_USER@localhost:$EXTERNAL_SHARE_DIR
    - cat $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml
-   - exce_log=`egrep -i 'warning|error|critical|exception' $OPENAIR_DIR/cmake_targets/autotests/log/python_autotest.log  |cat `
-   - if [ -n "$exce_log" ]; then  echo -e "\e[31mThere are errors in $NFS_TEST_RESULTS_DIR/log/python_autotest.log. Please check the logs\e[0m" ; fi
-   
+  when: manual  
diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index cabf1ee9b65f27ba7d22679a64e19bdce7fd263b..5d0f2a4149d998334baf080a7c0a7a9c4db823db 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -42,6 +42,7 @@ set (OPENAIR_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
 
 project (OpenAirInterface)
 
+#add_definitions("-DEMIT_ASN_DEBUG=1")
 add_subdirectory(${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lms7002m lms7002m)
 add_subdirectory(${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lmsSDR lmsSDR)
 add_subdirectory(${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/Si5351C Si5351C)
@@ -126,6 +127,7 @@ endmacro(add_list_string_option)
 if (CMAKE_BUILD_TYPE STREQUAL "")
    set(CMAKE_BUILD_TYPE "RelWithDebInfo")
 endif()
+message("CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}")
 add_list_string_option(CMAKE_BUILD_TYPE "RelWithDebInfo" "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." Debug Release RelWithDebInfo MinSizeRel)
 
 Message("Architecture is ${CMAKE_SYSTEM_PROCESSOR}")
@@ -554,7 +556,7 @@ elseif (${RF_BOARD} STREQUAL "OAI_USRP")
   set(HW_SOURCE ${HW_SOURCE}
     ${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp)
   LINK_DIRECTORIES("/opt/lib")
-  set(option_HW_lib "-luhd -rdynamic -ldl")
+  set(option_HW_lib "-luhd -rdynamic -ldl -lboost_system")
 
 elseif (${RF_BOARD} STREQUAL "OAI_BLADERF")
   include_directories("${OPENAIR_TARGETS}/ARCH/BLADERF/USERSPACE/LIB/")
@@ -1018,7 +1020,14 @@ add_library(SECU_CN ${SECU_CN_SRC})
 
 # Scheduler
 ################################"
-file(GLOB SCHED_SRC ${OPENAIR1_DIR}/SCHED/*.c)
+set(SCHED_SRC 
+  ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_eNb.c
+  ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_ue.c
+  ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.c
+  ${OPENAIR1_DIR}/SCHED/phy_mac_stub.c
+  ${OPENAIR1_DIR}/SCHED/pucch_pc.c
+  ${OPENAIR1_DIR}/SCHED/pusch_pc.c
+)
 add_library(SCHED_LIB ${SCHED_SRC})
 
 # Layer 1
@@ -1743,10 +1752,8 @@ target_link_libraries (lte-softmodem -ldl
   RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7
   -Wl,--end-group )
 
-
 target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
 target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB}  ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
-target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES})
 target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES})
 target_link_libraries (lte-softmodem ${T_LIB})
 
@@ -1782,9 +1789,8 @@ target_link_libraries (lte-softmodem-nos1
 
 target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES})
 target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES}  ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
-target_link_libraries (lte-softmodem-nos1 ${LIBBOOST_LIBRARIES})
 target_link_libraries (lte-softmodem-nos1  ${LIB_LMS_LIBRARIES})
-target_link_libraries (lte-softmodem ${T_LIB})
+target_link_libraries (lte-softmodem-nos1 ${T_LIB})
 
 # rrh
 ################################
@@ -1805,7 +1811,7 @@ target_link_libraries(rrh_gw
   UTIL LFDS  
   -Wl,--end-group )
 target_link_libraries (rrh_gw rt pthread m )
-target_link_libraries (rrh_gw  ${option_HW_lib} ${option_TP_lib} ${LIBBOOST_LIBRARIES} )
+target_link_libraries (rrh_gw  ${option_HW_lib} ${option_TP_lib})
 target_link_libraries (rrh_gw ${LIB_LMS_LIBRARIES})
 target_link_libraries (rrh_gw ${T_LIB})
 
diff --git a/cmake_targets/autotests/run_exec_lte-softmodem_tests.py b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py
index b25bc08427675a828ffc46edca332512bce57d9f..eed2fffb77a194fd82377a5f834fe1d4e475725e 100755
--- a/cmake_targets/autotests/run_exec_lte-softmodem_tests.py
+++ b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py
@@ -313,7 +313,7 @@ def SSHSessionWrapper(machine, username, key_file, password, logdir_remote, logd
 # \param CleanUpAluLteBox program to terminate AlU Bell Labs LTE Box
 # \param ExmimoRfStop String to stop EXMIMO card (specified in test_case_list.xml)
 def cleanOldPrograms(oai, programList, CleanUpAluLteBox, ExmimoRfStop, logdir, logdirOAI5GRepo):
-  cmd = 'killall -9 -q -r ' + programList
+  cmd = 'sudo -E killall -9 -q -r ' + programList
   result = oai.send(cmd, True)
   print "Killing old programs..." + result
   programArray = programList.split()
@@ -1020,6 +1020,13 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo ,
       run_result=0
       run_result_string = ' RUN_'+str(run) + ' = FAIL(Thread_Busy)'
 
+    #If there is Segmentation fault, we mark the test case as failure as most likely eNB crashed
+    cmd = "grep -ilr \"segmentation fault\" " + logdir_local_testcase + " | cat "
+    cmd_out = subprocess.check_output ([cmd], shell=True)
+    if len(cmd_out) !=0:
+      run_result=0
+      run_result_string = ' RUN_'+str(run) + ' = FAIL(SEGFAULT)'
+
     run_result_string = run_result_string + tput_run_string
 
     test_result=test_result & run_result
@@ -1261,7 +1268,8 @@ except KeyError:
    sys.exit(1)
 
 print "Killing zombie ssh sessions from earlier sessions..."
-cmd='ps aux |grep \"/usr/bin/ssh -q -l guptar\"|tr -s \" \" :|cut -f 2 -d :|xargs kill -9 '
+cmd='ps aux |grep \"/usr/bin/ssh -q -l guptar\"| awk \'{print $2}\' | sudo xargs kill -9  '
+
 os.system(cmd)
 
 if flag_start_testcase == False:
@@ -1426,13 +1434,25 @@ for oai in oai_list:
      
       setuplogfile  = logdir  + '/setup_log_' + MachineList[index] + '_.txt'
       setup_script  = locallogdir  + '/setup_script_' + MachineList[index] +  '_.txt'
+
+      #Sometimes git fails so the script below retries in that case
+      localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/tools/git-retry.sh')
+      remotefile = logdir + '/git-retry.sh'
+      paramList=[]
+      port=22
+      paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} )
+      sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log')
+      sftp_module (user, pw, MachineList[index], port, paramList, sftp_log)
+
+
       cmd = ' ( \n'
       #cmd = cmd  + 'rm -fR ' +  logdir + '\n'
       #cmd = cmd + 'mkdir -p ' + logdir + '\n'
       cmd = cmd + 'cd '+ logdir   + '\n'
-      cmd = cmd + 'git config --global http.sslVerify false \n' 
-      cmd = cmd + 'git clone  '+ GitOAI5GRepo  +' \n'
-      cmd = cmd + 'git clone '+ GitOpenaircnRepo + ' \n'
+      cmd = cmd + 'sudo apt-get install -y git \n'
+      cmd = cmd + 'chmod 700 ' + logdir + '/git-retry.sh \n' 
+      cmd = cmd + logdir + '/git-retry.sh clone  '+ GitOAI5GRepo  +' \n'
+      cmd = cmd + logdir + '/git-retry.sh clone '+ GitOpenaircnRepo + ' \n'
       cmd = cmd +  'cd ' + logdirOAI5GRepo  + '\n'
       cmd = cmd + 'git checkout ' + GitOAI5GRepoBranch   + '\n'                      
       #cmd = cmd + 'git checkout ' + GitOAI5GHeadVersion   + '\n'
diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml
index e2f34c7c90ee20ccaa7f02d8cac2700d65de3320..f042ed697156d666e1b0013be7a969b22e8cc531 100644
--- a/cmake_targets/autotests/test_case_list.xml
+++ b/cmake_targets/autotests/test_case_list.xml
@@ -1,18 +1,18 @@
 <testCaseList>
 
-<MachineList>mozart tique stevens nano amerique</MachineList>
+<MachineList>mozart hutch starsky stevens amerique calisson nano</MachineList>
  <NFSResultsShare>/mnt/sradio/TEST_RESULTS/</NFSResultsShare>
  <GitOAI5GRepo>https://gitlab.eurecom.fr/oai/openairinterface5g.git</GitOAI5GRepo>
  <GitOpenair-cnRepo>https://gitlab.eurecom.fr/oai/openair-cn.git</GitOpenair-cnRepo>
  <GitOAI5GRepoBranch>develop</GitOAI5GRepoBranch>
  <GitOpenair-cnRepoBranch>develop</GitOpenair-cnRepoBranch>
- <CleanUpOldProgs>oaisim oaisim_nos1 lte-softmodem lte-softmodem-nos1 mme_gw run_epc auth_request run_hss oai_hss mme spgw hss hss_sim configure_cots* wvdial  iperf iperf_script iperf_script_phone ping tshark rrh_gw iperf3 iperf3_script iperf3_script_phone pppd</CleanUpOldProgs>	
+ <CleanUpOldProgs>oaisim oaisim_nos1 lte-softmodem lte-softmodem-nos1 mme_gw run_epc auth_request run_hss oai_hss mme spgw hss hss_sim configure_cots* wvdial  iperf iperf_script iperf_script_phone ping tshark rrh_gw iperf3 iperf3_script iperf3_script_phone pppd starthss start_ltebox stop_ltebox configure_cots_sony_experia_m4_ue configure_cots_huaweiE398_ue configure_cots_bandrich_ue</CleanUpOldProgs>	
  <CleanUpAluLteBox>sudo -S -E /opt/ltebox/tools/stop_ltebox</CleanUpAluLteBox>
-<ExmimoRfStop>$OPENAIR_DIR/cmake_targets/build_oai -w EXMIMO -c; sudo -S -E $OPENAIR_DIR/cmake_targets/tools/stop_exmimo2; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py --reset-ue;  sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_sony_experia_m4_ue.py --stop-ue; uname -a; sudo -E dmesg</ExmimoRfStop>
+<ExmimoRfStop>exmimo_pci=`lspci -m | grep Xilinx`; if [ -n "$exmimo_pci" ] ; then $OPENAIR_DIR/cmake_targets/build_oai -w EXMIMO -c; sudo -S -E $OPENAIR_DIR/cmake_targets/tools/stop_exmimo2; fi; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py --reset-ue;  sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_sony_experia_m4_ue.py --stop-ue; uname -a; sudo -E dmesg</ExmimoRfStop>
  <Timeout_execution>36000</Timeout_execution>
- <TestCaseExclusionList>010141 0102+ 010304 010305 0104+ 015502 015505 015506 015507 015508 015509 015510 015511 015514 015517 015602 015605 015702 015705 015802 015805 015808 015811 016102 016105 016502 016505 017002 017005 017502 017505 018002 018005 018502 018505 025502 025505 025508 025511</TestCaseExclusionList>
+ <TestCaseExclusionList>010141 0102+ 010304 010305 0104+ 015502 015505 015508 015511 015514 015517 015602 015605 015702 015705 015802 015805 015808 015811 016102 016105 016502 016505 017002 017005 017502 017505 018002 018005 018502 018505 025502 025505 025508 025511</TestCaseExclusionList>
  <nruns_lte-softmodem>3</nruns_lte-softmodem>
- <MachineListGeneric>mozart tique stevens nano amerique </MachineListGeneric>
+ <MachineListGeneric>mozart hutch starsky stevens amerique calisson </MachineListGeneric>
      <testCase id="010101" >
      <class>compilation</class>
      <desc>Build oaisim.Rel8</desc>
@@ -391,12 +391,12 @@
       <pre_exec_args></pre_exec_args>
       <test_config_file></test_config_file>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -x 1 -s15
-                       -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -x 1 -s15 
-                       -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -x 1 -s15 
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -x 2 -s15 
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50  -x 2 -s15 
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100  -x 2 -s15 </main_exec_args>
+      <main_exec_args> -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -s15
+                       -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -s15 
+                       -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -s15 
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -s15 
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -s15 
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -s15 </main_exec_args>
       <tags>oaisim_noS1.tdd.5MHz.TM1 oaisim_noS1.tdd.10MHz.TM1 oaisim_noS1.tdd.20MHz.TM1 oaisim_noS1.tdd.5MHz.TM2 oaisim_noS1.tdd.10MHz.TM2 oaisim_noS1.tdd.20MHz.TM2</tags>
       <search_expr_true>"Received RRCConnectionReconfigurationComplete from UE 0"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
@@ -413,12 +413,12 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -x 1 -a -s15
-                       -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -x 1 -a -s15 
-                       -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -x 1 -a -s15 
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -x 2 -a -s15 
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50  -x 2 -a -s15
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100  -x 2 -a -s15 </main_exec_args>
+      <main_exec_args> -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -a -s15
+                       -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -a -s15 
+                       -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -a -s15 
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -a -s15 
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -a -s15
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -a -s15 </main_exec_args>
       <tags>oaisim_noS1.tdd.5MHz.TM1 oaisim_noS1.tdd.10MHz.TM1 oaisim_noS1.tdd.20MHz.TM1 oaisim_noS1.tdd.5MHz.TM2 oaisim_noS1.tdd.10MHz.TM2 oaisim_noS1.tdd.20MHz.TM2</tags>
       <search_expr_true>"Received RRCConnectionReconfigurationComplete from UE 0"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
@@ -435,12 +435,12 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -x 1 -s15
-                       -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -x 1 -s15
-                       -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -x 1 -s15
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -x 2 -s15
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50  -x 2 -s15
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100  -x 2 -s15 </main_exec_args>
+      <main_exec_args> -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -s15
+                       -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -s15
+                       -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -s15
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -s15
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -s15
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -s15 </main_exec_args>
       <tags>oaisim_noS1.tdd.5MHz.TM1 oaisim_noS1.tdd.10MHz.TM1 oaisim_noS1.tdd.20MHz.TM1 oaisim_noS1.tdd.5MHz.TM2 oaisim_noS1.tdd.10MHz.TM2 oaisim_noS1.tdd.20MHz.TM2 </tags>
       <search_expr_true>"Received RRCConnectionReconfigurationComplete from UE 0" "Received RRCConnectionReconfigurationComplete from UE 1" "Received RRCConnectionReconfigurationComplete from UE 2"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
@@ -457,12 +457,12 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -x 1 -a -s15
-                       -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -x 1 -a -s15
-                       -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -x 1 -a -s15
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -x 2 -a -s15
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50  -x 2 -a -s15
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100  -x 2 -a -s15</main_exec_args>
+      <main_exec_args> -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -a -s15
+                       -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -a -s15
+                       -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -a -s15
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -a -s15
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -a -s15
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -a -s15</main_exec_args>
       <tags>oaisim_noS1.tdd.5MHz.TM1 oaisim_noS1.tdd.10MHz.TM1 oaisim_noS1.tdd.20MHz.TM1 oaisim_noS1.tdd.5MHz.TM2 oaisim_noS1.tdd.10MHz.TM2  oaisim_nos1.tdd.20MHz.TM2</tags>
       <search_expr_true>"Received RRCConnectionReconfigurationComplete from UE 0" "Received RRCConnectionReconfigurationComplete from UE 1" "Received RRCConnectionReconfigurationComplete from UE 2"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
@@ -479,12 +479,12 @@
       <pre_exec_args></pre_exec_args>
       <test_config_file></test_config_file>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -x 1 -c26 
-                       -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -x 1 -c26 
-                       -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -x 1 -c26 
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -x 2 -c26 
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50  -x 2 -c26 
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100  -x 2 -c26</main_exec_args>
+      <main_exec_args> -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -c26 
+                       -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -c26 
+                       -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -c26 
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -c26 
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -c26 
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -c26</main_exec_args>
       <tags>oaisim_noS1.tdd.5MHz.TM1 oaisim_noS1.tdd.10MHz.TM1 oaisim_noS1.tdd.20MHz.TM1 oaisim_noS1.tdd.5MHz.TM2 oaisim_noS1.tdd.10MHz.TM2 oaisim_noS1.tdd.20MHz.TM2 </tags>
       <search_expr_true>"DL and UL loss rate below 10"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
@@ -501,12 +501,12 @@
       <pre_exec_args></pre_exec_args>
       <test_config_file></test_config_file>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -x 1 -c26 -a
-                       -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -x 1 -c26  -a
-                       -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -x 1 -c26 -a
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -x 2 -c26  -a
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50  -x 2 -c26 -a
-                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100  -x 2 -c26  -a</main_exec_args>
+      <main_exec_args> -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -c26 -a
+                       -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -c26  -a
+                       -O $OPENAIR_LOGDIR/enb.band38.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -c26 -a
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -c26  -a
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -c26 -a
+                      -O $OPENAIR_LOGDIR/enb.band38.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -c26  -a</main_exec_args>
       <tags>oaisim_noS1.tdd.5MHz.TM1 oaisim_noS1.tdd.10MHz.TM1 oaisim_noS1.tdd.20MHz.TM1 oaisim_noS1.tdd.5MHz.TM2 oaisim_noS1.tdd.10MHz.TM2 oaisim_noS1.tdd.20MHz.TM2 </tags>
       <search_expr_true>"DL and UL loss rate below 10"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
@@ -522,12 +522,12 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -x 1 -F -s15
-                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -x 1 -F -s15
-                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -x 1 -F -s15
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -x 2 -F -s15
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50  -x 2 -F -s15
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100  -x 2 -F -s15</main_exec_args>
+      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -F -s15
+                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -F -s15
+                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -F -s15
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -F -s15
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -F -s15
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -F -s15</main_exec_args>
       <tags>oaisim_noS1.FDD.5MHz.TM1 oaisim_noS1.FDD.10MHz.TM1 oaisim_noS1.FDD.20MHz.TM1 oaisim_noS1.FDD.5MHz.TM2 oaisim_noS1.FDD.10MHz.TM2 oaisim_noS1.FDD.20MHz.TM2</tags>
       <search_expr_true>"Received RRCConnectionReconfigurationComplete from UE 0"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
@@ -543,12 +543,12 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -x 1 -F -a -s15
-                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -x 1 -F -a -s15
-                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -x 1 -F -a -s15
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -x 2 -F -a -s15
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50  -x 2 -F -a -s15
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100  -x 2 -F -a -s15</main_exec_args>
+      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -F -a -s15
+                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -F -a -s15
+                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -F -a -s15
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -F -a -s15
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -F -a -s15
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -F -a -s15</main_exec_args>
       <tags>oaisim_noS1.FDD.5MHz.TM1 oaisim_noS1.FDD.10MHz.TM1 oaisim_noS1.FDD.20MHz.TM1 oaisim_noS1.FDD.5MHz.TM2 oaisim_noS1.FDD.10MHz.TM2 oaisim_noS1.FDD.20MHz.TM2</tags> 
       <search_expr_true>"Received RRCConnectionReconfigurationComplete from UE 0"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
@@ -564,12 +564,12 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -x 1 -F -s15
-                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -x 1 -F -s15
-                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -x 1 -F -s15
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -x 2 -F -s15
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50  -x 2 -F -s15
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100  -x 2 -F -s15</main_exec_args>
+      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -F -s15
+                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -F -s15
+                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -F -s15
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -F -s15
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -F -s15
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -F -s15</main_exec_args>
       <tags>oaisim_noS1.FDD.5MHz.TM1 oaisim_noS1.FDD.10MHz.TM1 oaisim_noS1.FDD.20MHz.TM1 oaisim_noS1.FDD.5MHz.TM2 oaisim_noS1.FDD.10MHz.TM2 oaisim_noS1.FDD.20MHz.TM2 </tags> 
       <search_expr_true>"Received RRCConnectionReconfigurationComplete from UE 0" "Received RRCConnectionReconfigurationComplete from UE 1" "Received RRCConnectionReconfigurationComplete from UE 2"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
@@ -585,12 +585,12 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -x 1 -F -a -s15
-                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -x 1 -F -a -s15
-                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -x 1 -F -a -s15
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -x 2 -F -a -s15
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50  -x 2 -F -a -s15
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100  -x 2 -F -a -s15</main_exec_args>
+      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -F -a -s15
+                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -F -a -s15
+                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -F -a -s15
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 25 -F -a -s15
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 50 -F -a -s15
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u3 -n100 -R 100 -F -a -s15</main_exec_args>
       <tags>oaisim_noS1.FDD.5MHz.TM1 oaisim_noS1.FDD.10MHz.TM1 oaisim_noS1.FDD.20MHz.TM1 oaisim_noS1.FDD.5MHz.TM2 oaisim_noS1.FDD.10MHz.TM2 oaisim_noS1.FDD.20MHz.TM2</tags>
       <search_expr_true>"Received RRCConnectionReconfigurationComplete from UE 0" "Received RRCConnectionReconfigurationComplete from UE 1" "Received RRCConnectionReconfigurationComplete from UE 2"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
@@ -606,12 +606,12 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -x 1 -F -c26
-                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -x 1 -F -c26
-                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -x 1 -F -c26
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -x 2 -F -c26
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50  -x 2 -F -c26
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100  -x 2 -F -c26</main_exec_args>
+      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -F -c26
+                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -F -c26
+                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -F -c26
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -F -c26
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -F -c26
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -F -c26</main_exec_args>
       <tags>oaisim_noS1.FDD.5MHz.TM1 oaisim_noS1.FDD.10MHz.TM1 oaisim_noS1.FDD.20MHz.TM1 oaisim_noS1.FDD.5MHz.TM2 oaisim_noS1.FDD.10MHz.TM2 oaisim_noS1.FDD.20MHz.TM2</tags>
       <search_expr_true>"DL and UL loss rate below 10"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
@@ -627,12 +627,12 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -x 1 -F -c26 -a
-                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -x 1 -F -c26 -a
-                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -x 1 -F -c26 -a
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -x 2 -F -c26 -a
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50  -x 2 -F -c26 -a
-                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100  -x 2 -F -c26 -a</main_exec_args>
+      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -F -c26 -a
+                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -F -c26 -a
+                       -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -F -c26 -a
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 25 -F -c26 -a
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 50 -F -c26 -a
+                      -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -b1 -u1 -n100 -R 100 -F -c26 -a</main_exec_args>
       <tags>oaisim_noS1.FDD.5MHz.TM1 oaisim_noS1.FDD.10MHz.TM1 oaisim_noS1.FDD.20MHz.TM1 oaisim_noS1.FDD.5MHz.TM2 oaisim_noS1.FDD.10MHz.TM2 oaisim_noS1.FDD.20MHz.TM2 </tags>
       <search_expr_true>"DL and UL loss rate below 10"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
@@ -648,7 +648,7 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -l7 -x 1 -Q3 -n 100 -b1 -u1</main_exec_args>
+      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -l7 -Q3 -n 100 -b1 -u1</main_exec_args>
       <search_expr_true>"Found MBSFNAreaConfiguration from eNB 0"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
       <tags>oaisim_noS1.eMBMS</tags>
@@ -664,7 +664,7 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -l7 -x 1 -T mscbr -Q3 -n 100 -b1 -u1</main_exec_args>
+      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -l7 -T mscbr -Q3 -n 100 -b1 -u1</main_exec_args>
       <search_expr_true>"Received a multicast packet"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
       <tags>oaisim_noS1.eMBMS</tags>
@@ -680,7 +680,7 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -l7 -F -T mscbr -x 1 -Q3 -n 100 -b1 -u1</main_exec_args>
+      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -l7 -F -T mscbr -Q3 -n 100 -b1 -u1</main_exec_args>
       <search_expr_true>"Received a multicast packet"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
       <tags>oaisim_noS1.eMBMS</tags>
@@ -696,7 +696,7 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash; $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec>$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1</main_exec>
-      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -A AWGN -l7 -c43 -F -T mbvbr -Q4 -j1 -n120</main_exec_args>
+      <main_exec_args> -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf -A AWGN -l7 -c43 -F -T mbvbr -Q4 -j1 -n120</main_exec_args>
       <search_expr_true>"MTCH for sync area 1"</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
       <tags>oaisim_noS1.eMBMS</tags>
@@ -929,7 +929,7 @@
   <testCase id="015500" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -946,16 +946,16 @@
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -1004,7 +1004,7 @@
   <testCase id="015501" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -1021,16 +1021,16 @@
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -1078,7 +1078,7 @@
   <testCase id="015502" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -1095,17 +1095,17 @@
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -E -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -1152,7 +1152,7 @@
   <testCase id="015503" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -1169,16 +1169,16 @@
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -1225,7 +1225,7 @@
   <testCase id="015504" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -1242,16 +1242,16 @@
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf     </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -1298,7 +1298,7 @@
   <testCase id="015505" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -1315,17 +1315,17 @@
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -E -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -1373,34 +1373,34 @@
   <testCase id="015506" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
     <eNB_working_dir>/tmp</eNB_working_dir>
-    <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  tracking_area_code \"1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mobile_country_code \"208\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mobile_network_code \"92\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  N_RB_DL 25
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  downlink_frequency 2660000000L
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  uplink_frequency_offset -120000000
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  tx_gain 90
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  rx_gain 125
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  2
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 2
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
+    <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  tracking_area_code \"1\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mobile_country_code \"208\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mobile_network_code \"92\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  N_RB_DL 25
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  downlink_frequency 2660000000L
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  uplink_frequency_offset -120000000
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  tx_gain 90
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  rx_gain 125
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  frame_type \"FDD\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  nb_antennas_rx  2
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  nb_antennas_tx 2
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -1415,7 +1415,7 @@
     <UE_pre_exec_args></UE_pre_exec_args>
     <UE_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue;$OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; sleep 10; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue </UE_main_exec>
     <UE_main_exec_args></UE_main_exec_args>
-    <UE_traffic_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c  192.172.0.1 -b 10Mbits/s    -B 192.172.0.2</UE_traffic_exec>
+    <UE_traffic_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c  192.172.0.1 -b 7Mbits/s    </UE_traffic_exec>
     <UE_traffic_exec_args></UE_traffic_exec_args>
     <UE_search_expr_true></UE_search_expr_true>
     <UE_search_expr_false></UE_search_expr_false>
@@ -1448,34 +1448,34 @@
   <testCase id="015507" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
     <eNB_working_dir>/tmp</eNB_working_dir>
-    <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  tracking_area_code \"1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mobile_country_code \"208\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mobile_network_code \"92\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  N_RB_DL 50
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  downlink_frequency 2660000000L
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  uplink_frequency_offset -120000000
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  tx_gain 90
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  rx_gain 125
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  2
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 2
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
+    <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  tracking_area_code \"1\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mobile_country_code \"208\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mobile_network_code \"92\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  N_RB_DL 50
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  downlink_frequency 2660000000L
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  uplink_frequency_offset -120000000
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  tx_gain 90
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  rx_gain 125
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  frame_type \"FDD\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  nb_antennas_rx  2
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  nb_antennas_tx 2
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -1489,7 +1489,7 @@
     <UE_pre_exec_args></UE_pre_exec_args>
     <UE_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue;$OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; sleep 10; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue </UE_main_exec>
     <UE_main_exec_args></UE_main_exec_args>
-    <UE_traffic_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c  192.172.0.1 -b 10Mbits/s    -B 192.172.0.2</UE_traffic_exec>
+    <UE_traffic_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c  192.172.0.1 -b 14Mbits/s    </UE_traffic_exec>
     <UE_traffic_exec_args></UE_traffic_exec_args>
     <UE_search_expr_true></UE_search_expr_true>
     <UE_search_expr_false></UE_search_expr_false>
@@ -1521,34 +1521,34 @@
   <testCase id="015508" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
     <eNB_working_dir>/tmp</eNB_working_dir>
-    <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  tracking_area_code \"1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mobile_country_code \"208\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mobile_network_code \"92\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  N_RB_DL 100
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  downlink_frequency 2660000000L
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  uplink_frequency_offset -120000000
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  tx_gain 90
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  rx_gain 125
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  2
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 2
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
+    <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  tracking_area_code \"1\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mobile_country_code \"208\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mobile_network_code \"92\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  N_RB_DL 100
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  downlink_frequency 2660000000L
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  uplink_frequency_offset -120000000
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  tx_gain 90
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  rx_gain 125
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  frame_type \"FDD\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  nb_antennas_rx  2
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  nb_antennas_tx 2
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -E -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -1563,7 +1563,7 @@
     <UE_pre_exec_args></UE_pre_exec_args>
     <UE_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; sleep 10; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue </UE_main_exec>
     <UE_main_exec_args></UE_main_exec_args>
-    <UE_traffic_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c  192.172.0.1 -b 10Mbits/s    -B 192.172.0.2</UE_traffic_exec>
+    <UE_traffic_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0 -u -c  192.172.0.1 -b 28Mbits/s    </UE_traffic_exec>
     <UE_traffic_exec_args></UE_traffic_exec_args>
     <UE_search_expr_true></UE_search_expr_true>
     <UE_search_expr_false></UE_search_expr_false>
@@ -1595,34 +1595,34 @@
   <testCase id="015509" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
     <eNB_working_dir>/tmp</eNB_working_dir>
-    <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  tracking_area_code \"1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mobile_country_code \"208\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mobile_network_code \"92\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  N_RB_DL 25
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  downlink_frequency 2660000000L
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  uplink_frequency_offset -120000000
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  tx_gain 90
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  rx_gain 125
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  2
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 2
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
+    <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  tracking_area_code \"1\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mobile_country_code \"208\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mobile_network_code \"92\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  N_RB_DL 25
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  downlink_frequency 2660000000L
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  uplink_frequency_offset -120000000
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  tx_gain 90
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  rx_gain 125
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  frame_type \"FDD\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  nb_antennas_rx  2
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  nb_antennas_tx 2
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -1658,7 +1658,7 @@
     <EPC_main_exec_args></EPC_main_exec_args>
     <HSS_main_exec>/opt/hss_sim0609/starthss >> /dev/null ; sleep 3000 </HSS_main_exec>
     <HSS_main_exec_args></HSS_main_exec_args>
-    <EPC_traffic_exec>$OPENAIRCN_DIR/TEST/autotests/tools/iperf_script 60 lo -u -c  192.172.0.2 -b 10Mbits/s</EPC_traffic_exec>
+    <EPC_traffic_exec>$OPENAIRCN_DIR/TEST/autotests/tools/iperf_script 10 192.172.0.2 -u -c  192.172.0.2 -b 16Mbits/s</EPC_traffic_exec>
     <EPC_traffic_exec_args></EPC_traffic_exec_args>
     <EPC_search_expr_false></EPC_search_expr_false>
     <EPC_terminate_missing_procs>False</EPC_terminate_missing_procs>
@@ -1669,34 +1669,34 @@
   <testCase id="015510" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
     <eNB_working_dir>/tmp</eNB_working_dir>
-    <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  tracking_area_code \"1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mobile_country_code \"208\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mobile_network_code \"92\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  N_RB_DL 50
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  downlink_frequency 2660000000L
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  uplink_frequency_offset -120000000
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  tx_gain 90
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  rx_gain 125
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  2
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 2
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
+    <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  tracking_area_code \"1\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mobile_country_code \"208\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mobile_network_code \"92\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  N_RB_DL 50
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  downlink_frequency 2660000000L
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  uplink_frequency_offset -120000000
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  tx_gain 90
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  rx_gain 125
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  frame_type \"FDD\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  nb_antennas_rx  2
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  nb_antennas_tx 2
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -1711,7 +1711,7 @@
     <UE_pre_exec_args></UE_pre_exec_args>
     <UE_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; sleep 10; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue </UE_main_exec>
     <UE_main_exec_args></UE_main_exec_args>
-    <UE_traffic_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0  -s -i 1 -u -f m -B 192.172.0.2</UE_traffic_exec>
+    <UE_traffic_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0  -s -i 1 -u -f m </UE_traffic_exec>
     <UE_traffic_exec_args></UE_traffic_exec_args>
     <UE_search_expr_true>throughput_test min=0.0Mbits/sec max=9.0Mbits/sec average=8.5Mbits/sec   </UE_search_expr_true>
     <UE_search_expr_false></UE_search_expr_false>
@@ -1732,7 +1732,7 @@
     <EPC_main_exec_args></EPC_main_exec_args>
     <HSS_main_exec>/opt/hss_sim0609/starthss >> /dev/null ; sleep 3000 </HSS_main_exec>
     <HSS_main_exec_args></HSS_main_exec_args>
-    <EPC_traffic_exec>$OPENAIRCN_DIR/TEST/autotests/tools/iperf_script  60 lo -u -c  192.172.0.2 -b 10Mbits/s </EPC_traffic_exec>
+    <EPC_traffic_exec>$OPENAIRCN_DIR/TEST/autotests/tools/iperf_script  10 192.172.0.2 -u -c  192.172.0.2 -b 33Mbits/s -i 1 -f m  </EPC_traffic_exec>
     <EPC_traffic_exec_args></EPC_traffic_exec_args>
     <EPC_search_expr_false></EPC_search_expr_false>
     <EPC_terminate_missing_procs>False</EPC_terminate_missing_procs>
@@ -1743,34 +1743,34 @@
   <testCase id="015511" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
     <eNB_working_dir>/tmp</eNB_working_dir>
-    <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  tracking_area_code \"1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mobile_country_code \"208\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mobile_network_code \"92\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  N_RB_DL 100
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  downlink_frequency 2660000000L
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  uplink_frequency_offset -120000000
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  tx_gain 90
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  rx_gain 125
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  2
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 2
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
+    <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  tracking_area_code \"1\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mobile_country_code \"208\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mobile_network_code \"92\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  N_RB_DL 100
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  downlink_frequency 2660000000L
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  uplink_frequency_offset -120000000
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  tx_gain 90
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  rx_gain 125
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  frame_type \"FDD\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  nb_antennas_rx  2
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  nb_antennas_tx 2
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -E -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -1785,7 +1785,7 @@
     <UE_pre_exec_args></UE_pre_exec_args>
     <UE_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; sleep 10; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue </UE_main_exec>
     <UE_main_exec_args></UE_main_exec_args>
-    <UE_traffic_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0  -s -i 1 -u -f m -B 192.172.0.2</UE_traffic_exec>
+    <UE_traffic_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/iperf_script 1 ppp0  -s -i 1 -u -f m </UE_traffic_exec>
     <UE_traffic_exec_args></UE_traffic_exec_args>
     <UE_search_expr_true>throughput_test min=0.0Mbits/sec max=15.0Mbits/sec average=15.0Mbits/sec   </UE_search_expr_true>
     <UE_search_expr_false></UE_search_expr_false>
@@ -1806,7 +1806,7 @@
     <EPC_main_exec_args></EPC_main_exec_args>
     <HSS_main_exec>/opt/hss_sim0609/starthss >> /dev/null ; sleep 3000 </HSS_main_exec>
     <HSS_main_exec_args></HSS_main_exec_args>
-    <EPC_traffic_exec>$OPENAIRCN_DIR/TEST/autotests/tools/iperf_script 60 lo -u -c  192.172.0.2 -b 10Mbits/s  </EPC_traffic_exec>
+    <EPC_traffic_exec>$OPENAIRCN_DIR/TEST/autotests/tools/iperf_script 10 192.172.0.2 -u -c  192.172.0.2 -b 10Mbits/s  </EPC_traffic_exec>
     <EPC_traffic_exec_args></EPC_traffic_exec_args>
     <EPC_search_expr_false></EPC_search_expr_false>
     <EPC_terminate_missing_procs>False</EPC_terminate_missing_procs>
@@ -1817,7 +1817,7 @@
   <testCase id="015512" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -1834,16 +1834,16 @@
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -1892,7 +1892,7 @@
   <testCase id="015513" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -1909,16 +1909,16 @@
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -1966,7 +1966,7 @@
   <testCase id="015514" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -1983,17 +1983,17 @@
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -E -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -2040,7 +2040,7 @@
   <testCase id="015515" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -2057,16 +2057,16 @@
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -2113,7 +2113,7 @@
   <testCase id="015516" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -2130,16 +2130,16 @@
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf     </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -2186,7 +2186,7 @@
   <testCase id="015517" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -2203,17 +2203,17 @@
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -E -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -3354,7 +3354,7 @@ c
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_usrpb210.py --stop-usrpb210 ; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash  ; sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -3426,7 +3426,7 @@ c
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_usrpb210.py --stop-usrpb210 ; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash  ; sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -3497,7 +3497,7 @@ c
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_usrpb210.py --stop-usrpb210 ; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash  ; sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -3569,7 +3569,7 @@ c
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_usrpb210.py --stop-usrpb210 ; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash  ; sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -3640,7 +3640,7 @@ c
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_usrpb210.py --stop-usrpb210 ; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash  ; sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec>
     <eNB_pre_exec_args>sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -3711,7 +3711,7 @@ c
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_usrpb210.py --stop-usrpb210 ; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -3782,7 +3782,7 @@ c
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_usrpb210.py --stop-usrpb210 ; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash  ; sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -3854,7 +3854,7 @@ c
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_usrpb210.py --stop-usrpb210 ; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash  ; sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -3925,7 +3925,7 @@ c
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_usrpb210.py --stop-usrpb210 ; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash  ; sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -3997,7 +3997,7 @@ c
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_usrpb210.py --stop-usrpb210 ; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash  ; sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -4068,7 +4068,7 @@ c
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_usrpb210.py --stop-usrpb210 ; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash  ; sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec>
     <eNB_pre_exec_args>sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -4139,7 +4139,7 @@ c
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_usrpb210.py --stop-usrpb210 ; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash ; sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -4212,7 +4212,7 @@ c
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>sleep 15; $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash  ;  sudo -E -S /usr/local/bin/niusrprio_pcie start ; dmesg|tail ; cp $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf $OPENAIR_TESTDIR/enb.conf</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -7007,7 +7007,7 @@ c
   <testCase id="025500" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -7024,16 +7024,16 @@ c
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -7082,7 +7082,7 @@ c
   <testCase id="025501" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -7099,16 +7099,16 @@ c
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -7156,7 +7156,7 @@ c
   <testCase id="025502" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -7173,17 +7173,17 @@ c
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf   -E  </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -7230,7 +7230,7 @@ c
   <testCase id="025503" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -7247,17 +7247,17 @@ c
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf   </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -7304,7 +7304,7 @@ c
   <testCase id="025504" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -7321,16 +7321,16 @@ c
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -7378,7 +7378,7 @@ c
   <testCase id="025505" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -7395,17 +7395,17 @@ c
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -E    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -7452,7 +7452,7 @@ c
   <testCase id="025506" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -7469,16 +7469,16 @@ c
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -7527,7 +7527,7 @@ c
   <testCase id="025507" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -7544,16 +7544,16 @@ c
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -7601,7 +7601,7 @@ c
   <testCase id="025508" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -7618,17 +7618,17 @@ c
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -E -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -7675,7 +7675,7 @@ c
   <testCase id="025509" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -7692,16 +7692,16 @@ c
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
     <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
@@ -7749,7 +7749,7 @@ c
   <testCase id="025510" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>tique</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -7766,17 +7766,17 @@ c
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.147/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth1\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.147/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -E -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -7823,7 +7823,7 @@ c
   <testCase id="025511" >
     <class>lte-softmodem</class>
     <desc></desc>
-    <eNB>calisson</eNB>
+    <eNB>hutch</eNB>
     <UE>stevens</UE>
     <EPC>amerique</EPC>
     <TimeOut_cmd>390</TimeOut_cmd>
@@ -7840,17 +7840,17 @@ c
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  frame_type \"FDD\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_rx  1
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  nb_antennas_tx 1
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.82/24\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth5\"
-                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.82/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1_MME       \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1_MME          \"192.168.12.19/24\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_INTERFACE_NAME_FOR_S1U          \"eth0\"
+                     targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_IPV4_ADDRESS_FOR_S1U           \"192.168.12.19/24\"
                      targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf  ENB_PORT_FOR_S1U                     2152</eNB_config_file>
     <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
     <eNB_compile_prog_args>--eNB -w USRP -x -c </eNB_compile_prog_args>
     <eNB_pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</eNB_pre_exec>
     <eNB_pre_exec_args></eNB_pre_exec_args>
-    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
-    <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
+    <eNB_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/run_gdb $OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
+    <eNB_main_exec_args> -E -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf    </eNB_main_exec_args>
     <eNB_traffic_exec></eNB_traffic_exec>
     <eNB_traffic_exec_args></eNB_traffic_exec_args>
     <eNB_search_expr_true></eNB_search_expr_true>
@@ -7897,7 +7897,3 @@ c
 
 
   </testCaseList>
-
-
-
-
diff --git a/cmake_targets/autotests/tools/git-retry.sh b/cmake_targets/autotests/tools/git-retry.sh
new file mode 100755
index 0000000000000000000000000000000000000000..b897ba379d0a9b12b755603d72bdcb64a254f302
--- /dev/null
+++ b/cmake_targets/autotests/tools/git-retry.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+#Simple script to retry git clone in case of failure
+
+REALGIT=/usr/bin/git
+
+RETRIES=10
+DELAY=10
+COUNT=1
+while [ $COUNT -lt $RETRIES ]; do
+  $REALGIT $* >> git-clone-`hostname`-log.txt 2>&1
+  if [ $? -eq 0 ]; then
+    RETRIES=0
+    break
+  fi
+  let COUNT=$COUNT+1
+  sleep $DELAY
+done
diff --git a/cmake_targets/autotests/tools/remove_old_programs.bash b/cmake_targets/autotests/tools/remove_old_programs.bash
index 772ba11f58342d542aba7ff980fa39996b82943f..c5c26e3752c1bcdc2208cf7ab5db22bba8fe2a48 100755
--- a/cmake_targets/autotests/tools/remove_old_programs.bash
+++ b/cmake_targets/autotests/tools/remove_old_programs.bash
@@ -1,7 +1,32 @@
 #!/bin/bash
 
 #$1 programs to be killed and checked
-var=`ps -A |grep -E -i $1`
+echo "removing old programs..."
+echo "args = $1"
+echo "script name = $0"
+filename=$(basename "$0")
+echo "filename = $filename"
+echo "programs to be killed...$1"
+
+echo "bash PID = $$" 
+pid="$$"
+echo "pid = $pid"
+
+echo "Killing programs now..."
+
+ps -aux |grep -E -i -w "$1"
+
+var=`ps -aux |grep -E -i -w "$1" |awk '{print $2}'| tr '\n' ' ' | sed  "s/$pid/ /"`
+echo "Killing processes...$var"
+#var=`ps -aux |grep -E -i '$1' |awk '{print $2}'| tr '\n' ' ' | sed  "s/$pid/ /"`
+#echo $var 
+if [ -n "$var" ] ; then  sudo  kill -9 $var ; fi
+
+#| sudo xargs kill -9 
+
+echo "checking for old programs..."
+var=`ps -aux |grep -E -i -w '$1' |grep -Ev 'grep' | grep -Ev '$filename'`
+
 echo $var
 if [ -n "$var" ]; then echo 'Match found'; else echo 'Match not found' ;fi 
 
diff --git a/cmake_targets/autotests/tools/run_gdb b/cmake_targets/autotests/tools/run_gdb
new file mode 100755
index 0000000000000000000000000000000000000000..a12d6ce21dc0c7df6fc77c200ee766ebe7dab3f6
--- /dev/null
+++ b/cmake_targets/autotests/tools/run_gdb
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+#arg0 -> Name of executable
+#args[1...N] -> arguments to be passed to executable
+if [ -z "$OPENAIR_DIR" ]
+then
+    echo "OPENAIR_DIR environment not set. Exiting.."
+    exit
+fi 
+
+source $OPENAIR_DIR/cmake_targets/tools/build_helper
+
+args=($*)
+exec_name=${args[0]}
+exe_args=(${args[@]:1})
+gdb_file=$OPENAIR_DIR/targets/bin/gdb_file
+gdb_log=$OPENAIR_DIR/targets/bin/gdb_log.bt
+
+echo "args = ${args[@]}"
+echo "exec_name = $exec_name"
+echo "exe_args = ${exe_args[@]}"
+echo "gdb log file = $gdb_log"
+
+$SUDO rm -fr $gdb_file $gdb_log
+$SUDO touch $gdb_file $gdb_log 
+$SUDO chmod 777  $gdb_file $gdb_log
+
+$SUDO echo "file $exec_name"                  >> $gdb_file
+$SUDO echo "set args ${exe_args[@]}"          >> $gdb_file
+$SUDO echo "run"                              >> $gdb_file
+$SUDO echo "set logging overwrite on"         >> $gdb_file
+$SUDO echo "set logging file $gdb_log"        >> $gdb_file
+$SUDO echo "set logging on"                   >> $gdb_file
+$SUDO echo "set pagination off"               >> $gdb_file
+$SUDO echo "handle SIG33 pass nostop noprint" >> $gdb_file
+$SUDO echo "echo backtrace:\n"                >> $gdb_file
+$SUDO echo "backtrace full"                   >> $gdb_file
+$SUDO echo "echo \n\nVariables:\n"            >> $gdb_file
+$SUDO echo "info variables"                   >> $gdb_file
+$SUDO echo "echo \n\nlocals:\n"               >> $gdb_file
+$SUDO echo "info locals"                      >> $gdb_file
+$SUDO echo "echo \n\nregisters:\n"            >> $gdb_file
+$SUDO echo "info registers"                   >> $gdb_file
+$SUDO echo "echo \n\ncurrent instructions:\n" >> $gdb_file 
+$SUDO echo "x/16i \$pc"                       >> $gdb_file
+$SUDO echo "echo \n\nthreads backtrace:\n"    >> $gdb_file
+$SUDO echo "thread apply all backtrace"       >> $gdb_file
+$SUDO echo "set logging off"                  >> $gdb_file
+$SUDO echo "quit"                             >> $gdb_file
+
+echo "Contents of gdb_file...start"
+$SUDO cat $gdb_file
+echo "Contents of gdb_file...finish"
+
+$SUDO gdb -n -x $gdb_file 2>&1
+
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 04289a83fa0c1b23f233b1aac01e24295cb6e0b1..625e2fcf5ee4cf53c55f42cb5a55bcb8a1b74f33 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -61,6 +61,7 @@ TEST_CASE_GROUP=""
 BUILD_DOXYGEN=0
 T_TRACER="False"
 DISABLE_HARDWARE_DEPENDENCY="False"
+CMAKE_BUILD_TYPE=""
 trap handle_ctrl_c INT
 
 function print_help() {
@@ -82,7 +83,7 @@ Options
 --install-optional-packages
    Install useful but not mandatory packages such as valgrind
 -g | --run-with-gdb
-   Add debugging symbols to compilation directives
+   Add debugging symbols to compilation directives. It also disables any compiler optimization.
 -h | --help
    Print this help
 --eNB
@@ -170,7 +171,8 @@ function main() {
             shift;;
        -g | --run-with-gdb)
             GDB=1
-            echo_info "Will Compile with gdb symbols"
+            CMAKE_BUILD_TYPE="Debug"
+            echo_info "Will Compile with gdb symbols and disable compiler optimization"
             shift;;
        --eNB)
             eNB=1
@@ -331,7 +333,7 @@ function main() {
   #By default: EXMIMO: enable
   if [ "$FORCE_DEADLINE_SCHEDULER_FLAG_USER" = "" ]; then
      if [ "$HW" = "EXMIMO" ] ; then 
-        DEADLINE_SCHEDULER_FLAG_USER="False"
+        DEADLINE_SCHEDULER_FLAG_USER="True"
      elif [ "$HW" = "ETHERNET" ] ; then 
         DEADLINE_SCHEDULER_FLAG_USER="True"
      elif [ "$HW" = "OAI_USRP" ] ; then 
@@ -446,6 +448,7 @@ function main() {
     if [ "$NOS1" = "1" ] ; then
 	cat  $DIR/$lte_build_dir/CMakeLists.template >>  $cmake_file
     fi
+    echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
     echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >>  $cmake_file
     echo "set ( XFORMS $XFORMS )"                  >>  $cmake_file
     echo "set ( RRC_ASN1_VERSION \"${REL}\")"      >>  $cmake_file
@@ -571,6 +574,8 @@ function main() {
     cp $OPENAIR_DIR/cmake_targets/tools/init_exmimo2 $dbin
   fi
 
+  # oaisim compilation
+  ###############
   if [ "$oaisim" = "1" ] ; then
     dconf=$OPENAIR_DIR/targets/bin
       if [ "$NOS1" =  "1" ] ; then
@@ -584,6 +589,7 @@ function main() {
     echo_info "Compiling $oaisim_exec ($oaisim_build_dir)"
     cmake_file=$DIR/$oaisim_build_dir/CMakeLists.txt
     cp $DIR/$oaisim_build_dir/CMakeLists.template $cmake_file
+    echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
     echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >>  $cmake_file
     echo "set ( XFORMS $XFORMS )" >>  $cmake_file
     echo "set ( PRINT_STATS $PRINT_STATS )" >>  $cmake_file
@@ -652,9 +658,10 @@ function main() {
 
     cmake_file=$DIR/oaisim_mme_build_oai/CMakeLists.txt
     cp $DIR/oaisim_mme_build_oai/CMakeLists.template $cmake_file
-    echo "set(XFORMS $XFORMS )" >>  $cmake_file
-    echo "set(RRC_ASN1_VERSION \"${REL}\")" >>  $cmake_file
-    echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >>  $cmake_file
+    echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
+    echo "set ( XFORMS $XFORMS )" >>  $cmake_file
+    echo "set ( RRC_ASN1_VERSION \"${REL}\")" >>  $cmake_file
+    echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >>  $cmake_file
     echo "set ( T_TRACER $T_TRACER )"        >>  $cmake_file
     echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
     #[ "$CLEAN" = "1" ] && rm -rf $DIR/oaisim_mme_build_oai/build
@@ -679,13 +686,14 @@ function main() {
      mkdir -p $DIR/$rrh_build_dir/build
      cmake_file=$DIR/$rrh_build_dir/CMakeLists.txt
      echo "cmake_minimum_required(VERSION 2.8)"   >   $cmake_file
-     echo "set(ENABLE_VCD_FIFO $VCD_TIMING )"     >>  $cmake_file
-     echo "set(ENABLE_ITTI False )"     		 >>  $cmake_file
-     echo "set(RF_BOARD \"${HW}\")"               >>  $cmake_file
-     echo "set(TRANSP_PRO \"${TP}\")"             >>  $cmake_file
-     echo 'set(PACKAGE_NAME "\"rrh_gw\"")'        >>  $cmake_file
-     echo "set (DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )"    >>$cmake_file
-     echo "set (CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )"    >>$cmake_file
+     echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
+     echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )"     >>  $cmake_file
+     echo "set ( ENABLE_ITTI False )"     		 >>  $cmake_file
+     echo "set ( RF_BOARD \"${HW}\")"               >>  $cmake_file
+     echo "set ( TRANSP_PRO \"${TP}\")"             >>  $cmake_file
+     echo 'set ( PACKAGE_NAME "\"rrh_gw\"")'        >>  $cmake_file
+     echo "set ( DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )"    >>$cmake_file
+     echo "set ( CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )"    >>$cmake_file
      echo "set ( T_TRACER $T_TRACER )"            >>  $cmake_file
      echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file    
      cd $DIR/$rrh_build_dir/build
diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index b5742001026a2393b0605912e70fdac581ade156..32e9f76d475ab7fa3345965c845fb874f53e4343 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -1,4 +1,4 @@
-################################################################################
+ ################################################################################
 #
 # Copyright (c) 2015, EURECOM (www.eurecom.fr)
 # All rights reserved.
@@ -236,10 +236,8 @@ install_gnutls_from_source(){
     cd /tmp 
     echo "Downloading gnutls archive"
     $SUDO rm -rf /tmp/gnutls-3.1.23.tar.xz* /tmp/gnutls-3.1.23
-    wget http://mirrors.dotsrc.org/gcrypt/gnutls/v3.1/gnutls-3.1.23.tar.xz
-    if [ $? -ne 0 ]; then
+    wget http://mirrors.dotsrc.org/gcrypt/gnutls/v3.1/gnutls-3.1.23.tar.xz || \
       wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.1/gnutls-3.1.23.tar.xz
-    fi
     if [ ! -f gnutls-3.1.23.tar.xz ]; then
       echo_error "Could not download gnutls source files"
       cd -
@@ -316,7 +314,8 @@ check_install_additional_tools (){
         android-tools-adb \
 	wvdial \
         python-numpy \
-    sshpass
+    sshpass \
+    nscd
 
     $SUDO pip install paramiko
     $SUDO pip install pyroute2
@@ -401,7 +400,6 @@ check_install_oai_software() {
 	libxml2 \
 	libxml2-dev  \
 	libxslt1-dev \
-	linux-headers-`uname -r` \
 	mscgen  \
 	octave \
 	octave-signal \
@@ -418,6 +416,8 @@ check_install_oai_software() {
 
     $SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
     
+    #Sometimes linux headers are not available in apt-get if kernel is custom or new
+    $SUDO apt-get install linux-headers-`uname -r` || true
     # First we remove gnutls/nettle installation and then install from sources
     $SUDO apt-get remove -y libgnutls-dev nettle-dev nettle-bin
     install_nettle_from_source
@@ -434,13 +434,9 @@ install_asn1c_from_source(){
     asn1_install_log=$OPENAIR_DIR/cmake_targets/log/asn1c_install_log.txt
     echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log "
     (
-    $SUDO rm -rf /tmp/asn1c-r1516
-    svn co https://github.com/vlm/asn1c/trunk  /tmp/asn1c-r1516 -r 1516
-    cd /tmp/asn1c-r1516 
-    patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch.p0 
-    patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_2.p0 
-    patch -p0 < $OPENAIR_DIR/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0 
-    patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_3.p0 
+    $SUDO rm -rf /tmp/asn1c
+    git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c
+    cd /tmp/asn1c
     ./configure
     make -j`nproc`
     $SUDO make install
@@ -495,6 +491,8 @@ CURPID=$$
 ppid=$$
 arraycounter=1
 echo_info "** Trapped CTRL-C. Killing all subprocesses now..."
+echo_info "** Calling sync now..."
+sync 
 while true
 do
         FORLOOP=FALSE
diff --git a/cmake_targets/tools/run_enb_ue_virt_s1 b/cmake_targets/tools/run_enb_ue_virt_s1
index 8f7255332a19169888484e7e0cd54698230e1750..93da7aeb3b8f774f605643551cb4b67c053ee677 100755
--- a/cmake_targets/tools/run_enb_ue_virt_s1
+++ b/cmake_targets/tools/run_enb_ue_virt_s1
@@ -252,11 +252,14 @@ function main()
   # Check table 200 lte in /etc/iproute2/rt_tables
   fgrep lte /etc/iproute2/rt_tables  > /dev/null
   if [ $? -ne 0 ]; then
-    bash -c echo "200 lte " >> /etc/iproute2/rt_tables
+    echo "200 lte " >> /etc/iproute2/rt_tables
   fi
   ip rule add fwmark 1 table lte 
   ifconfig oip1 up
   ip route add default dev oip1 table lte
+  # the actual IP address depends on the EPC/MME config file for address pool
+  ip route add from 192.188.0.0/24 table lte
+  ip route add to 192.188.0.0/24 table lte
 
   exe_arguments="$exe_arguments -s15 -AAWGN -y1 -b1 -u1 -Q0"
     
diff --git a/common/utils/T/.gitignore b/common/utils/T/.gitignore
index a52d9a36677c9d9d15f873b7f0f874248b55c86c..f5724e6ff8c25fd4bf1fc8701f7ca881de58194a 100644
--- a/common/utils/T/.gitignore
+++ b/common/utils/T/.gitignore
@@ -9,4 +9,5 @@ tracer/record
 tracer/replay
 tracer/textlog
 tracer/vcd
+tracer/macpdu2wireshark
 tracee/tracee
diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt
index 05c08085c62558544725b4ad4580c663f17c9de0..050c48d0a9c78c99ce24a33bb19db25708f2397f 100644
--- a/common/utils/T/T_messages.txt
+++ b/common/utils/T/T_messages.txt
@@ -95,6 +95,10 @@ ID = ENB_MAC_UE_UL_CE
     DESC = MAC uplink UE received control element
     GROUP = ALL:MAC:ENB
     FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,ce
+ID = ENB_MAC_UE_DL_PDU_WITH_DATA
+    DESC = MAC downlink PDU for an UE
+    GROUP = ALL:MAC:ENB
+    FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data
 
 #RLC logs
 ID = ENB_RLC_DL
diff --git a/common/utils/T/tracer/Makefile b/common/utils/T/tracer/Makefile
index ee289aae59636c629934de82eddbedf0932d832d..71f1d25f9251b375dd5f57d88b59d78f979b3b11 100644
--- a/common/utils/T/tracer/Makefile
+++ b/common/utils/T/tracer/Makefile
@@ -5,7 +5,7 @@ CFLAGS=-Wall -g -pthread -DT_TRACER -I.
 
 LIBS=-lX11 -lm -lpng -lXft
 
-all: record replay extract_config textlog enb vcd
+all: record replay extract_config textlog enb vcd macpdu2wireshark
 
 record: utils.o record.o database.o config.o
 	$(CC) $(CFLAGS) -o record $^ $(LIBS)
@@ -31,6 +31,10 @@ vcd: utils.o vcd.o database.o event.o handler.o config.o \
          filter/filter.a
 	$(CC) $(CFLAGS) -o vcd $^ $(LIBS)
 
+macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \
+                  config.o
+	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
+
 .PHONY: all gui/gui.a view/view.a logger/logger.a filter/filter.a
 
 gui/gui.a:
@@ -50,7 +54,7 @@ filter/filter.a:
 
 clean:
 	rm -f *.o core tracer_remote textlog enb vcd record replay
-	rm -f extract_config
+	rm -f extract_config macpdu2wireshark
 	cd gui && make clean
 	cd view && make clean
 	cd logger && make clean
diff --git a/common/utils/T/tracer/event_selector.c b/common/utils/T/tracer/event_selector.c
index a03846c0566a98faef440f7eb991793209d676e4..2b6cfd878de99faf5944f6a32511c883f545ae96 100644
--- a/common/utils/T/tracer/event_selector.c
+++ b/common/utils/T/tracer/event_selector.c
@@ -34,11 +34,14 @@ static void scroll(void *private, gui *g,
   int number_of_lines;
   int new_line;
   int inc;
+  int *d = notification_data;
+  int key_modifiers = *d;
 
   textlist_state(g, w, &visible_lines, &start_line, &number_of_lines);
   inc = 10;
   if (inc > visible_lines - 2) inc = visible_lines - 2;
   if (inc < 1) inc = 1;
+  if (key_modifiers & KEY_CONTROL) inc = 1;
   if (!strcmp(notification, "scrollup")) inc = -inc;
 
   new_line = start_line + inc;
diff --git a/common/utils/T/tracer/gui/gui.h b/common/utils/T/tracer/gui/gui.h
index 673514f138ec88c58fa4a88b6487cbb3db9f0578..27e6603042fa24d928933031d822609b5115f084 100644
--- a/common/utils/T/tracer/gui/gui.h
+++ b/common/utils/T/tracer/gui/gui.h
@@ -83,8 +83,8 @@ int new_color(gui *gui, char *color);
 /* notifications */
 /* known notifications:
  * - textlist:
- *      - scrollup   { void *: NULL }
- *      - scrolldown { void *: NULL }
+ *      - scrollup   { int: key_modifiers }
+ *      - scrolldown { int: key_modifiers }
  *      - click      { int [2]: line, button }
  * - label:
  *      - click      { int: button } (if enabled)
diff --git a/common/utils/T/tracer/gui/textlist.c b/common/utils/T/tracer/gui/textlist.c
index 896cba5b9e8b6949321af0789214780552fede12..e919b7c0a51fcc6b14cd9449388e99bd7773bb2d 100644
--- a/common/utils/T/tracer/gui/textlist.c
+++ b/common/utils/T/tracer/gui/textlist.c
@@ -54,11 +54,11 @@ static void button(gui *_g, widget *_this, int x, int y,
   x -= this->common.x;
   /* scroll up */
   if (button == 4 && up == 0) {
-    gui_notify(g, "scrollup", _this, NULL);
+    gui_notify(g, "scrollup", _this, &key_modifiers);
   }
   /* scroll down */
   if (button == 5 && up == 0) {
-    gui_notify(g, "scrolldown", _this, NULL);
+    gui_notify(g, "scrolldown", _this, &key_modifiers);
   }
   /* button 1/2/3 click */
   if (button >= 1 && button <= 3 && up == 0) {
diff --git a/common/utils/T/tracer/macpdu2wireshark.c b/common/utils/T/tracer/macpdu2wireshark.c
new file mode 100644
index 0000000000000000000000000000000000000000..886638f5ef2c6774045395cc593e20cbd12a50a9
--- /dev/null
+++ b/common/utils/T/tracer/macpdu2wireshark.c
@@ -0,0 +1,260 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include "database.h"
+#include "event.h"
+#include "handler.h"
+#include "config.h"
+#include "utils.h"
+#include "packet-mac-lte.h"
+
+#define DEFAULT_IP   "127.0.0.1"
+#define DEFAULT_PORT 9999
+
+typedef struct {
+  int socket;
+  struct sockaddr_in to;
+  OBUF buf;
+  /* ul */
+  int ul_rnti;
+  int ul_frame;
+  int ul_subframe;
+  int ul_data;
+  /* dl */
+  int dl_rnti;
+  int dl_frame;
+  int dl_subframe;
+  int dl_data;
+} ev_data;
+
+void ul(void *_d, event e)
+{
+  ev_data *d = _d;
+  ssize_t ret;
+  int fsf;
+  int i;
+
+  d->buf.osize = 0;
+
+  PUTS(&d->buf, MAC_LTE_START_STRING);
+  PUTC(&d->buf, FDD_RADIO);
+  PUTC(&d->buf, DIRECTION_UPLINK);
+  PUTC(&d->buf, C_RNTI);
+
+  PUTC(&d->buf, MAC_LTE_RNTI_TAG);
+  PUTC(&d->buf, (e.e[d->ul_rnti].i>>8) & 255);
+  PUTC(&d->buf, e.e[d->ul_rnti].i & 255);
+
+  /* for newer version of wireshark? */
+  fsf = (e.e[d->ul_frame].i << 4) + e.e[d->ul_subframe].i;
+  /* for older version? */
+  fsf = e.e[d->ul_subframe].i;
+  PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG);
+  PUTC(&d->buf, (fsf>>8) & 255);
+  PUTC(&d->buf, fsf & 255);
+
+  PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG);
+  for (i = 0; i < e.e[d->ul_data].bsize; i++)
+    PUTC(&d->buf, ((char*)e.e[d->ul_data].b)[i]);
+
+  ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0,
+      (struct sockaddr *)&d->to, sizeof(struct sockaddr_in));
+  if (ret != d->buf.osize) abort();
+}
+
+void dl(void *_d, event e)
+{
+  ev_data *d = _d;
+  ssize_t ret;
+  int fsf;
+  int i;
+
+  d->buf.osize = 0;
+
+  PUTS(&d->buf, MAC_LTE_START_STRING);
+  PUTC(&d->buf, FDD_RADIO);
+  PUTC(&d->buf, DIRECTION_DOWNLINK);
+  PUTC(&d->buf, C_RNTI);
+
+  PUTC(&d->buf, MAC_LTE_RNTI_TAG);
+  PUTC(&d->buf, (e.e[d->dl_rnti].i>>8) & 255);
+  PUTC(&d->buf, e.e[d->dl_rnti].i & 255);
+
+  /* for newer version of wireshark? */
+  fsf = (e.e[d->dl_frame].i << 4) + e.e[d->dl_subframe].i;
+  /* for older version? */
+  fsf = e.e[d->dl_subframe].i;
+  PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG);
+  PUTC(&d->buf, (fsf>>8) & 255);
+  PUTC(&d->buf, fsf & 255);
+
+  PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG);
+  for (i = 0; i < e.e[d->dl_data].bsize; i++)
+    PUTC(&d->buf, ((char*)e.e[d->dl_data].b)[i]);
+
+  ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0,
+      (struct sockaddr *)&d->to, sizeof(struct sockaddr_in));
+  if (ret != d->buf.osize) abort();
+}
+
+void setup_data(ev_data *d, void *database, int ul_id, int dl_id)
+{
+  database_event_format f;
+  int i;
+
+  d->ul_rnti     = -1;
+  d->ul_frame    = -1;
+  d->ul_subframe = -1;
+  d->ul_data     = -1;
+
+  d->dl_rnti     = -1;
+  d->dl_frame    = -1;
+  d->dl_subframe = -1;
+  d->dl_data     = -1;
+
+#define G(var_name, var_type, var) \
+  if (!strcmp(f.name[i], var_name)) { \
+    if (strcmp(f.type[i], var_type)) goto error; \
+    var = i; \
+    continue; \
+  }
+
+  /* ul: rnti, frame, subframe, data */
+  f = get_format(database, ul_id);
+  for (i = 0; i < f.count; i++) {
+    G("rnti",     "int",    d->ul_rnti);
+    G("frame",    "int",    d->ul_frame);
+    G("subframe", "int",    d->ul_subframe);
+    G("data",     "buffer", d->ul_data);
+  }
+  if (d->ul_rnti == -1 || d->ul_frame == -1 || d->ul_subframe == -1 ||
+      d->ul_data == -1) goto error;
+
+  /* dl: rnti, frame, subframe, data */
+  f = get_format(database, dl_id);
+  for (i = 0; i < f.count; i++) {
+    G("rnti",     "int",    d->dl_rnti);
+    G("frame",    "int",    d->dl_frame);
+    G("subframe", "int",    d->dl_subframe);
+    G("data",     "buffer", d->dl_data);
+  }
+  if (d->dl_rnti == -1 || d->dl_frame == -1 || d->dl_subframe == -1 ||
+      d->dl_data == -1) goto error;
+
+#undef G
+
+  return;
+
+error:
+  printf("bad T_messages.txt\n");
+  abort();
+}
+
+void *receiver(void *_d)
+{
+  ev_data *d = _d;
+  int s;
+  char buf[100000];
+
+  s = socket(AF_INET, SOCK_DGRAM, 0);
+  if (s == -1) { perror("socket"); abort(); }
+
+  if (bind(s, (struct sockaddr *)&d->to, sizeof(struct sockaddr_in)) == -1)
+    { perror("bind"); abort(); }
+
+  while (1) {
+    if (recv(s, buf, 100000, 0) <= 0) abort();
+  }
+
+  return 0;
+}
+
+void usage(void)
+{
+  printf(
+"options:\n"
+"    -d <database file>        this option is mandatory\n"
+"    -in <dump file>           read events from this dump file\n"
+"    -ip <IP address>          send packets to this IP address (default %s)\n"
+"    -p <port>                 send packets to this port (default %d)\n",
+  DEFAULT_IP,
+  DEFAULT_PORT
+  );
+  exit(1);
+}
+
+int main(int n, char **v)
+{
+  char *database_filename = NULL;
+  char *input_filename = NULL;
+  void *database;
+  event_handler *h;
+  int in;
+  int i;
+  int ul_id, dl_id;
+  ev_data d;
+  char *ip = DEFAULT_IP;
+  int port = DEFAULT_PORT;
+
+  memset(&d, 0, sizeof(ev_data));
+
+  for (i = 1; i < n; i++) {
+    if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
+    if (!strcmp(v[i], "-d"))
+      { if (i > n-2) usage(); database_filename = v[++i]; continue; }
+    if (!strcmp(v[i], "-in"))
+      { if (i > n-2) usage(); input_filename = v[++i]; continue; }
+    if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; }
+    if (!strcmp(v[i], "-p")) {if(i>n-2)usage(); port=atoi(v[++i]); continue; }
+    usage();
+  }
+
+  if (database_filename == NULL) {
+    printf("ERROR: provide a database file (-d)\n");
+    exit(1);
+  }
+
+  if (input_filename == NULL) {
+    printf("ERROR: provide an input file (-i)\n");
+    exit(1);
+  }
+
+  in = open(input_filename, O_RDONLY);
+  if (in == -1) { perror(input_filename); return 1; }
+
+  database = parse_database(database_filename);
+  load_config_file(database_filename);
+
+  h = new_handler(database);
+
+  ul_id = event_id_from_name(database, "ENB_MAC_UE_UL_PDU_WITH_DATA");
+  dl_id = event_id_from_name(database, "ENB_MAC_UE_DL_PDU_WITH_DATA");
+  setup_data(&d, database, ul_id, dl_id);
+
+  register_handler_function(h, ul_id, ul, &d);
+  register_handler_function(h, dl_id, dl, &d);
+
+  d.socket = socket(AF_INET, SOCK_DGRAM, 0);
+  if (d.socket == -1) { perror("socket"); exit(1); }
+
+  d.to.sin_family = AF_INET;
+  d.to.sin_port = htons(port);
+  d.to.sin_addr.s_addr = inet_addr(ip);
+
+  new_thread(receiver, &d);
+
+  /* read messages */
+  while (1) {
+    char v[T_BUFFER_MAX];
+    event e;
+    e = get_event(in, v, database);
+    if (e.type == -1) break;
+    if (!(e.type == ul_id || e.type == dl_id)) continue;
+    handle_event(h, e);
+  }
+
+  return 0;
+}
diff --git a/common/utils/T/tracer/packet-mac-lte.h b/common/utils/T/tracer/packet-mac-lte.h
new file mode 100644
index 0000000000000000000000000000000000000000..039b9dc3c4cfe13cd5310f1e8a3c6275f081df9b
--- /dev/null
+++ b/common/utils/T/tracer/packet-mac-lte.h
@@ -0,0 +1,404 @@
+/* packet-mac-lte.h
+ *
+ * Martin Mathieson
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * This header file may also be distributed under
+ * the terms of the BSD Licence as follows:
+ *
+ * Copyright (C) 2009 Martin Mathieson. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE
+ */
+
+//#include "ws_symbol_export.h"
+
+/* radioType */
+#define FDD_RADIO 1
+#define TDD_RADIO 2
+
+/* Direction */
+#define DIRECTION_UPLINK   0
+#define DIRECTION_DOWNLINK 1
+
+/* rntiType */
+#define NO_RNTI     0
+#define P_RNTI      1
+#define RA_RNTI     2
+#define C_RNTI      3
+#define SI_RNTI     4
+#define SPS_RNTI    5
+#define M_RNTI      6
+#define SL_BCH_RNTI 7
+#define SL_RNTI     8
+#define SC_RNTI     9
+#define G_RNTI      10
+
+#if 0
+typedef enum mac_lte_oob_event {
+    ltemac_send_preamble,
+    ltemac_send_sr,
+    ltemac_sr_failure
+} mac_lte_oob_event;
+
+typedef enum mac_lte_dl_retx {
+    dl_retx_no,
+    dl_retx_yes,
+    dl_retx_unknown
+} mac_lte_dl_retx;
+
+typedef enum mac_lte_crc_status {
+    crc_fail = 0,
+    crc_success = 1,
+    crc_high_code_rate = 2,
+    crc_pdsch_lost = 3,
+    crc_duplicate_nonzero_rv = 4,
+    crc_false_dci = 5
+} mac_lte_crc_status;
+
+typedef enum mac_lte_carrier_id {
+    carrier_id_primary,
+    carrier_id_secondary_1,
+    carrier_id_secondary_2,
+    carrier_id_secondary_3,
+    carrier_id_secondary_4
+} mac_lte_carrier_id;
+
+typedef enum mac_lte_ce_mode {
+    no_ce_mode = 0,
+    ce_mode_a = 1,
+    ce_mode_b = 2
+} mac_lte_ce_mode;
+
+typedef enum mac_lte_nb_mode {
+    no_nb_mode = 0,
+    nb_mode = 1
+} mac_lte_nb_mode;
+
+/* Context info attached to each LTE MAC frame */
+typedef struct mac_lte_info
+{
+    /* Needed for decode */
+    guint8          radioType;
+    guint8          direction;
+    guint8          rntiType;
+
+    /* Extra info to display */
+    guint16         rnti;
+    guint16         ueid;
+
+    /* Timing info */
+    guint16         sysframeNumber;
+    guint16         subframeNumber;
+
+    /* Optional field. More interesting for TDD (FDD is always -4 subframeNumber) */
+    gboolean        subframeNumberOfGrantPresent;
+    guint16         subframeNumberOfGrant;
+
+    /* Flag set only if doing PHY-level data test - i.e. there may not be a
+       well-formed MAC PDU so just show as raw data */
+    gboolean        isPredefinedData;
+
+    /* Length of DL PDU or UL grant size in bytes */
+    guint16         length;
+
+    /* 0=newTx, 1=first-retx, etc */
+    guint8          reTxCount;
+    guint8          isPHICHNACK; /* FALSE=PDCCH retx grant, TRUE=PHICH NACK */
+
+    /* UL only.  Indicates if the R10 extendedBSR-Sizes parameter is set */
+    gboolean        isExtendedBSRSizes;
+
+    /* UL only.  Indicates if the R10 simultaneousPUCCH-PUSCH parameter is set for PCell */
+    gboolean        isSimultPUCCHPUSCHPCell;
+
+    /* UL only.  Indicates if the R10 extendedBSR-Sizes parameter is set for PSCell */
+    gboolean        isSimultPUCCHPUSCHPSCell;
+
+    /* Status of CRC check. For UE it is DL only. For eNodeB it is UL
+       only. For an analyzer, it is present for both DL and UL. */
+    gboolean        crcStatusValid;
+    mac_lte_crc_status crcStatus;
+
+    /* Carrier ID */
+    mac_lte_carrier_id   carrierId;
+
+    /* DL only.  Is this known to be a retransmission? */
+    mac_lte_dl_retx dl_retx;
+
+    /* DL only. CE mode to be used for RAR decoding */
+    mac_lte_ce_mode ceMode;
+
+    /* DL and UL. NB-IoT mode of the UE */
+    mac_lte_nb_mode nbMode;
+
+    /* More Physical layer info (see direction above for which side of union to use) */
+    union {
+        struct mac_lte_ul_phy_info
+        {
+            guint8 present;  /* Remaining UL fields are present and should be displayed */
+            guint8 modulation_type;
+            guint8 tbs_index;
+            guint8 resource_block_length;
+            guint8 resource_block_start;
+            guint8 harq_id;
+            gboolean ndi;
+        } ul_info;
+        struct mac_lte_dl_phy_info
+        {
+            guint8 present; /* Remaining DL fields are present and should be displayed */
+            guint8 dci_format;
+            guint8 resource_allocation_type;
+            guint8 aggregation_level;
+            guint8 mcs_index;
+            guint8 redundancy_version_index;
+            guint8 resource_block_length;
+            guint8 harq_id;
+            gboolean ndi;
+            guint8   transport_block;  /* 0..1 */
+        } dl_info;
+    } detailed_phy_info;
+
+    /* Relating to out-of-band events */
+    /* N.B. dissector will only look to these fields if length is 0... */
+    mac_lte_oob_event  oob_event;
+    guint8             rapid;
+    guint8             rach_attempt_number;
+    #define MAX_SRs 20
+    guint16            number_of_srs;
+    guint16            oob_ueid[MAX_SRs];
+    guint16            oob_rnti[MAX_SRs];
+} mac_lte_info;
+
+
+typedef struct mac_lte_tap_info {
+    /* Info from context */
+    guint16  rnti;
+    guint16  ueid;
+    guint8   rntiType;
+    guint8   isPredefinedData;
+    gboolean crcStatusValid;
+    mac_lte_crc_status   crcStatus;
+    guint8   direction;
+
+    guint8   isPHYRetx;
+    guint16  ueInTTI;
+
+    nstime_t mac_lte_time;
+
+    /* Number of bytes (which part is used depends upon context settings) */
+    guint32  single_number_of_bytes;
+    guint32  bytes_for_lcid[11];
+    guint32  sdus_for_lcid[11];
+    guint8   number_of_rars;
+    guint8   number_of_paging_ids;
+
+    /* Number of padding bytes includes padding subheaders and trailing padding */
+    guint16  padding_bytes;
+    guint16  raw_length;
+} mac_lte_tap_info;
+
+
+/* Accessor function to check if a frame was considered to be ReTx */
+int is_mac_lte_frame_retx(packet_info *pinfo, guint8 direction);
+
+#endif
+
+/*****************************************************************/
+/* UDP framing format                                            */
+/* -----------------------                                       */
+/* Several people have asked about dissecting MAC by framing     */
+/* PDUs over IP.  A suggested format over UDP has been created   */
+/* and implemented by this dissector, using the definitions      */
+/* below. A link to an example program showing you how to encode */
+/* these headers and send LTE MAC PDUs on a UDP socket is        */
+/* provided at https://wiki.wireshark.org/MAC-LTE                 */
+/*                                                               */
+/* A heuristic dissecter (enabled by a preference) will          */
+/* recognise a signature at the beginning of these frames.       */
+/*****************************************************************/
+
+
+/* Signature.  Rather than try to define a port for this, or make the
+   port number a preference, frames will start with this string (with no
+   terminating NULL */
+#define MAC_LTE_START_STRING "mac-lte"
+
+/* Fixed fields.  This is followed by the following 3 mandatory fields:
+   - radioType (1 byte)
+   - direction (1 byte)
+   - rntiType (1 byte)
+   (where the allowed values are defined above */
+
+/* Optional fields. Attaching this info to frames will allow you
+   to show you display/filter/plot/add-custom-columns on these fields, so should
+   be added if available.
+   The format is to have the tag, followed by the value (there is no length field,
+   it's implicit from the tag) */
+
+#define MAC_LTE_RNTI_TAG            0x02
+/* 2 bytes, network order */
+
+#define MAC_LTE_UEID_TAG            0x03
+/* 2 bytes, network order */
+
+#define MAC_LTE_FRAME_SUBFRAME_TAG  0x04
+/* 2 bytes, network order, SFN is stored in 12 MSB and SF in 4 LSB */
+
+#define MAC_LTE_PREDEFINED_DATA_TAG 0x05
+/* 1 byte */
+
+#define MAC_LTE_RETX_TAG            0x06
+/* 1 byte */
+
+#define MAC_LTE_CRC_STATUS_TAG      0x07
+/* 1 byte */
+
+#define MAC_LTE_EXT_BSR_SIZES_TAG   0x08
+/* 0 byte */
+
+#define MAC_LTE_SEND_PREAMBLE_TAG   0x09
+/* 2 bytes, RAPID value (1 byte) followed by RACH attempt number (1 byte) */
+
+#define MAC_LTE_CARRIER_ID_TAG      0x0A
+/* 1 byte */
+
+#define MAC_LTE_PHY_TAG             0x0B
+/* variable length, length (1 byte) then depending on direction
+   in UL: modulation type (1 byte), TBS index (1 byte), RB length (1 byte),
+          RB start (1 byte), HARQ id (1 byte), NDI (1 byte)
+   in DL: DCI format (1 byte), resource allocation type (1 byte), aggregation level (1 byte),
+          MCS index (1 byte), redundancy version (1 byte), resource block length (1 byte),
+          HARQ id (1 byte), NDI (1 byte), TB (1 byte), DL reTx (1 byte) */
+
+#define MAC_LTE_SIMULT_PUCCH_PUSCH_PCELL  0x0C
+/* 0 byte */
+
+#define MAC_LTE_SIMULT_PUCCH_PUSCH_PSCELL 0x0D
+/* 0 byte */
+
+#define MAC_LTE_CE_MODE             0x0E
+/* 1 byte containing mac_lte_ce_mode enum value */
+
+#define MAC_LTE_NB_MODE             0x0F
+/* 1 byte containing mac_lte_nb_mode enum value */
+
+/* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU
+   continues until the end of the frame) */
+#define MAC_LTE_PAYLOAD_TAG 0x01
+
+
+#if 0
+
+/* Type to store parameters for configuring LCID->RLC channel settings for DRB */
+/* Some are optional, and may not be seen (e.g. on reestablishment) */
+typedef struct drb_mapping_t
+{
+    guint16    ueid;                /* Mandatory */
+    guint8     drbid;               /* Mandatory */
+    gboolean   lcid_present;
+    guint8     lcid;                /* Part of LogicalChannelConfig - optional */
+    gboolean   rlcMode_present;
+    guint8     rlcMode;             /* Part of RLC config - optional */
+    gboolean   rlc_ul_ext_li_field; /* Part of RLC config - optional */
+    gboolean   rlc_dl_ext_li_field; /* Part of RLC config - optional */
+    gboolean   rlc_ul_ext_am_sn;    /* Part of RLC config - optional */
+    gboolean   rlc_dl_ext_am_sn;    /* Part of RLC config - optional */
+    gboolean   um_sn_length_present;
+    guint8     um_sn_length;        /* Part of RLC config - optional */
+    gboolean   ul_priority_present;
+    guint8     ul_priority;         /* Part of LogicalChannelConfig - optional */
+    gboolean   pdcp_sn_size_present;
+    guint8     pdcp_sn_size;        /* Part of pdcp-Config - optional */
+} drb_mapping_t;
+
+
+/* Set details of an LCID -> drb channel mapping.  To be called from
+   configuration protocol (e.g. RRC) */
+void set_mac_lte_channel_mapping(drb_mapping_t *drb_mapping);
+
+
+/* Dedicated DRX config. Used to verify that a sensible config is given.
+   Also, beginning to configure MAC with this config and (optionally) show
+   DRX config and state (cycles/timers) attached to each UL/DL PDU! */
+typedef struct drx_config_t {
+    gboolean    configured;
+    guint32     frameNum;
+    guint32     previousFrameNum;
+
+    guint32     onDurationTimer;
+    guint32     inactivityTimer;
+    guint32     retransmissionTimer;
+    guint32     longCycle;
+    guint32     cycleOffset;
+    /* Optional Short cycle */
+    gboolean    shortCycleConfigured;
+    guint32     shortCycle;
+    guint32     shortCycleTimer;
+} drx_config_t;
+
+/* Functions to set/release up dedicated DRX config */
+void set_mac_lte_drx_config(guint16 ueid, drx_config_t *drx_config, packet_info *pinfo);
+void set_mac_lte_drx_config_release(guint16 ueid,  packet_info *pinfo);
+
+/* RRC can tell this dissector which RAPIDs are Group A, Group A&B */
+void set_mac_lte_rapid_ranges(guint groupA, guint all_RA);
+
+/* RRC can indicate whether extended BSR sizes are used */
+void set_mac_lte_extended_bsr_sizes(guint16 ueid, gboolean use_ext_bsr_sizes, packet_info *pinfo);
+
+/* RRC can indicate whether simultaneous PUCCH/PUSCH is used */
+typedef enum {
+    SIMULT_PUCCH_PUSCH_PCELL = 0,
+    SIMULT_PUCCH_PUSCH_PSCELL
+} simult_pucch_pusch_cell_type;
+void set_mac_lte_simult_pucch_pusch(guint16 ueid, simult_pucch_pusch_cell_type cell_type, gboolean use_simult_pucch_pusch, packet_info *pinfo);
+
+/* Functions to be called from outside this module (e.g. in a plugin, where mac_lte_info
+   isn't available) to get/set per-packet data */
+WS_DLL_PUBLIC
+mac_lte_info *get_mac_lte_proto_data(packet_info *pinfo);
+WS_DLL_PUBLIC
+void set_mac_lte_proto_data(packet_info *pinfo, mac_lte_info *p_mac_lte_info);
+
+/* Function to attempt to populate p_mac_lte_info using framing definition above */
+gboolean dissect_mac_lte_context_fields(struct mac_lte_info  *p_mac_lte_info, tvbuff_t *tvb,
+                                        gint *p_offset);
+
+#endif
diff --git a/common/utils/T/tracer/view/textlist.c b/common/utils/T/tracer/view/textlist.c
index 5227900e4ef36d241b8fd62c2233d0d7ba9a2620..b89314191c9728ee763d6eacda22653ab05e53f5 100644
--- a/common/utils/T/tracer/view/textlist.c
+++ b/common/utils/T/tracer/view/textlist.c
@@ -89,6 +89,8 @@ static void scroll(void *private, gui *g,
   int number_of_lines;
   int new_line;
   int inc;
+  int *d = notification_data;
+  int key_modifiers = *d;
 
   if (pthread_mutex_lock(&this->lock)) abort();
 
@@ -96,6 +98,7 @@ static void scroll(void *private, gui *g,
   inc = 10;
   if (inc > visible_lines - 2) inc = visible_lines - 2;
   if (inc < 1) inc = 1;
+  if (key_modifiers & KEY_CONTROL) inc = 1;
   if (!strcmp(notification, "scrollup")) inc = -inc;
 
   new_line = start_line + inc;
@@ -122,7 +125,19 @@ static void click(void *private, gui *g,
 
   if (pthread_mutex_lock(&this->lock)) abort();
 
-  if (button == 1) this->autoscroll = 1 - this->autoscroll;
+  if (button == 1) this->autoscroll = 1;
+  if (button == 3) this->autoscroll = 0;
+
+  if (this->autoscroll) {
+    int visible_lines, start_line, number_of_lines;
+    textlist_state(this->g, this->w, &visible_lines, &start_line,
+        &number_of_lines);
+    start_line = number_of_lines - visible_lines;
+    if (start_line < 0) start_line = 0;
+    textlist_set_start_line(this->g, this->w, start_line);
+    /* this call is not necessary, but if things change in textlist... */
+    widget_dirty(this->g, this->w);
+  }
 
   if (pthread_mutex_unlock(&this->lock)) abort();
 }
diff --git a/maketags b/maketags
index 53bc1c12d006c33d1ca096e9251ab4ca35878d49..361adc5d67eed32c67bc41ab1d59eb946aded209 100755
--- a/maketags
+++ b/maketags
@@ -1,3 +1,4 @@
 #!/bin/sh
 echo "building ctags for openair1 and openair2 ..."
-ctags -e -R  --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair2/RRC/CELLULAR/ --exclude=openair2/NAS/DRIVER/CELLULAR/ --exclude=openair2/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 openair3 targets common
+ctags -e -R  --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair2/RRC/CELLULAR/ --exclude=openair2/NAS/DRIVER/CELLULAR/ --exclude=openair2/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 openair3 targets cmake_targets common
+
diff --git a/openair1/PHY/INIT/defs.h b/openair1/PHY/INIT/defs.h
index f08ca678db02cdc77517e4eb3df7f58221089f87..5762d871f826f575206883c20f56ccbcfa610cde 100644
--- a/openair1/PHY/INIT/defs.h
+++ b/openair1/PHY/INIT/defs.h
@@ -313,6 +313,18 @@ void phy_init_lte_top(LTE_DL_FRAME_PARMS *lte_frame_parms);
 
 //void copy_lte_parms_to_phy_framing(LTE_DL_FRAME_PARMS *frame_parm, PHY_FRAMING *phy_framing);
 
+void lte_param_init(unsigned char N_tx, 
+		    unsigned char N_rx,
+		    unsigned char transmission_mode,
+		    uint8_t extended_prefix_flag,
+		    frame_t frame_type, 
+		    uint16_t Nid_cell,
+		    uint8_t tdd_config,
+		    uint8_t N_RB_DL,
+		    uint8_t threequarter_fs,
+                    uint8_t osf,
+		    uint32_t perfect_ce);
+
 #ifdef Rel10
 void phy_config_dedicated_scell_ue(uint8_t Mod_id,
                                    uint8_t eNB_index,
diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c
index 6a50c2d113a6042656da4a1361b253c7132328f1..e78714db13ead2668a494ad978e9e8591aa87e2e 100644
--- a/openair1/PHY/INIT/lte_init.c
+++ b/openair1/PHY/INIT/lte_init.c
@@ -473,7 +473,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_eNB)
 
       if (physicalConfigDedicated->antennaInfo) {
         phy_vars_eNB->transmission_mode[UE_id] = 1+(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode);
-        LOG_D(PHY,"Transmission Mode %d\n",phy_vars_eNB->transmission_mode[UE_id]);
+        LOG_I(PHY,"Transmission Mode (phy_config_dedicated_eNB_step2) %d\n",phy_vars_eNB->transmission_mode[UE_id]);
         LOG_D(PHY,"\n");
       }
 
@@ -651,7 +651,41 @@ void phy_config_dedicated_eNB(uint8_t Mod_id,
 
   if (physicalConfigDedicated) {
     phy_vars_eNB->physicalConfigDedicated[UE_id] = physicalConfigDedicated;
-    LOG_I(PHY,"phy_config_dedicated_eNB: physicalConfigDedicated=%p\n",physicalConfigDedicated);
+    LOG_D(PHY,"phy_config_dedicated_eNB: physicalConfigDedicated=%p\n",physicalConfigDedicated);
+
+    if (physicalConfigDedicated->antennaInfo) {
+      switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) {
+      case AntennaInfoDedicated__transmissionMode_tm1:
+	phy_vars_eNB->transmission_mode[UE_id] = 1;
+	break;
+      case AntennaInfoDedicated__transmissionMode_tm2:
+	phy_vars_eNB->transmission_mode[UE_id] = 2;
+	break;
+      case AntennaInfoDedicated__transmissionMode_tm3:
+	phy_vars_eNB->transmission_mode[UE_id] = 3;
+	break;
+      case AntennaInfoDedicated__transmissionMode_tm4:
+	phy_vars_eNB->transmission_mode[UE_id] = 4;
+	break;
+      case AntennaInfoDedicated__transmissionMode_tm5:
+	phy_vars_eNB->transmission_mode[UE_id] = 5;
+	break;
+      case AntennaInfoDedicated__transmissionMode_tm6:
+	phy_vars_eNB->transmission_mode[UE_id] = 6;
+	break;
+      case AntennaInfoDedicated__transmissionMode_tm7:
+	phy_vars_eNB->transmission_mode[UE_id] = 7;
+	break;
+      default:
+	LOG_E(PHY,"Unknown transmission mode!\n");
+	break;
+      }
+      LOG_I(PHY,"Transmission Mode (phy_config_dedicated_eNB) %d\n",phy_vars_eNB->transmission_mode[UE_id]);
+ 
+    } else {
+      LOG_D(PHY,"[eNB %d] Frame %d: Received NULL radioResourceConfigDedicated->antennaInfo from eNB %d\n",Mod_id, phy_vars_eNB->proc[8].frame_tx,UE_id);
+    }
+
   } else {
     LOG_E(PHY,"[eNB %d] Frame %d: Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, phy_vars_eNB->proc[8].frame_tx,UE_id);
     return;
@@ -814,6 +848,34 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t CH_index,
       phy_vars_ue->transmission_mode[CH_index] = 1+(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode);
       LOG_D(PHY,"Transmission Mode %d\n",phy_vars_ue->transmission_mode[CH_index]);
       LOG_D(PHY,"\n");
+      switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) {
+      case AntennaInfoDedicated__transmissionMode_tm1:
+	phy_vars_ue->transmission_mode[CH_index] = 1;
+	break;
+      case AntennaInfoDedicated__transmissionMode_tm2:
+	phy_vars_ue->transmission_mode[CH_index] = 2;
+	break;
+      case AntennaInfoDedicated__transmissionMode_tm3:
+	phy_vars_ue->transmission_mode[CH_index] = 3;
+	break;
+      case AntennaInfoDedicated__transmissionMode_tm4:
+	phy_vars_ue->transmission_mode[CH_index] = 4;
+	break;
+      case AntennaInfoDedicated__transmissionMode_tm5:
+	phy_vars_ue->transmission_mode[CH_index] = 5;
+	break;
+      case AntennaInfoDedicated__transmissionMode_tm6:
+	phy_vars_ue->transmission_mode[CH_index] = 6;
+	break;
+      case AntennaInfoDedicated__transmissionMode_tm7:
+	phy_vars_ue->transmission_mode[CH_index] = 7;
+	break;
+      default:
+	LOG_E(PHY,"Unknown transmission mode!\n");
+	break;
+      } 
+    } else {
+      LOG_D(PHY,"[UE %d] Frame %d: Received NULL physicalConfigDedicated->antennaInfo from eNB %d\n",Mod_id, phy_vars_ue->frame_rx,CH_index);
     }
 
     if (physicalConfigDedicated->schedulingRequestConfig) {
diff --git a/openair1/PHY/INIT/lte_param_init.c b/openair1/PHY/INIT/lte_param_init.c
index 0db51e8b170c001e8f221b3b6acde2993ee297c8..603c09be38a7b0117a6787ee883f4d900846c016 100644
--- a/openair1/PHY/INIT/lte_param_init.c
+++ b/openair1/PHY/INIT/lte_param_init.c
@@ -50,8 +50,10 @@ void lte_param_init(unsigned char N_tx,
   lte_frame_parms->nushift            = Nid_cell%6;
   lte_frame_parms->nb_antennas_tx     = N_tx;
   lte_frame_parms->nb_antennas_rx     = N_rx;
-  lte_frame_parms->nb_antennas_tx_eNB = N_tx;
-  lte_frame_parms->phich_config_common.phich_resource         = one;
+  lte_frame_parms->nb_antennas_tx_eNB = (transmission_mode == 1)? 1 : 2;
+  lte_frame_parms->phich_config_common.phich_resource = oneSixth;
+  lte_frame_parms->phich_config_common.phich_duration = normal;
+
   lte_frame_parms->tdd_config         = tdd_config;
   lte_frame_parms->frame_type         = frame_type;
   //  lte_frame_parms->Csrs = 2;
diff --git a/openair1/PHY/INIT/lte_parms.c b/openair1/PHY/INIT/lte_parms.c
index fa0e731af97830ad22bad3c85f89584cd8246e07..fc2602d697640903821b0072b215886d335af3f8 100644
--- a/openair1/PHY/INIT/lte_parms.c
+++ b/openair1/PHY/INIT/lte_parms.c
@@ -191,6 +191,7 @@ void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms)
   printf("frame_parms->tdd_config=%d\n",frame_parms->tdd_config);
   printf("frame_parms->tdd_config_S=%d\n",frame_parms->tdd_config_S);
   printf("frame_parms->mode1_flag=%d\n",frame_parms->mode1_flag);
+  printf("frame_parms->nb_antennas_tx_eNB(nb_antenna_ports)=%d\n",frame_parms->nb_antennas_tx_eNB);
   printf("frame_parms->nb_antennas_tx=%d\n",frame_parms->nb_antennas_tx);
   printf("frame_parms->nb_antennas_rx=%d\n",frame_parms->nb_antennas_rx);
   printf("frame_parms->ofdm_symbol_size=%d\n",frame_parms->ofdm_symbol_size);
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
index 29f46a9d2e344aa8a80874a9cf62531387937b04..1de23f64122c72abf0b4e680a748c7305a814ad2 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
@@ -41,8 +41,8 @@ static int16_t temp_out_ifft_0[2048*4] __attribute__((aligned(16)));
 static int16_t temp_out_ifft_1[2048*4] __attribute__((aligned(16)));
 
 
-static int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(16)));
-static int32_t temp_in_ifft_1[2048*2] __attribute__((aligned(16)));
+static int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
+static int32_t temp_in_ifft_1[2048*2] __attribute__((aligned(32)));
 static int32_t temp_in_fft_0[2048*2] __attribute__((aligned(16)));
 static int32_t temp_in_fft_1[2048*2] __attribute__((aligned(16)));
 
diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c
index e79f603a49c5245f5bc761ffc808b51b0aacfe68..523dfd4d03607d43b34b32b509dd8cf977440e69 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci.c
@@ -1754,7 +1754,7 @@ int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars,
     for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
       avgs = cmax(avgs,avgP[(aarx<<1)+aatx]);
 
-  log2_maxh = (log2_approx(avgs)/2) + 6 + frame_parms->nb_antennas_rx - 1;
+  log2_maxh = (log2_approx(avgs)/2) + 5;  //+frame_parms->nb_antennas_rx;
 #ifdef DEBUG_PHY
   LOG_I(PHY,"subframe %d: pdcch log2_maxh = %d (%d,%d)\n",subframe,log2_maxh,avgP[0],avgs);
 #endif
@@ -2086,17 +2086,16 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
                   frame_parms,
                   txdataF,
                   subframe);
-
   wbar[0] = &wbar0[0];
   wbar[1] = &wbar1[0];
   y[0] = &yseq0[0];
   y[1] = &yseq1[0];
 
   // reset all bits to <NIL>, here we set <NIL> elements as 2
-  memset(e, 2, DCI_BITS_MAX);
-  //  // here we interpret NIL as a random QPSK sequence. That makes power estimation easier.
-  //  for (i=0; i<DCI_BITS_MAX; i++)
-  //    e[i]=2;//taus()&1;
+  // memset(e, 2, DCI_BITS_MAX);
+  // here we interpret NIL as a random QPSK sequence. That makes power estimation easier.
+  for (i=0; i<DCI_BITS_MAX; i++)
+    e[i]=taus()&1;
 
   e_ptr = e;
 
@@ -2190,15 +2189,15 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
       LOG_I(PHY," PDCCH Modulation (TX diversity): REG %d\n",i>>2);
 #endif
       // first antenna position n -> x0
-      ((int16_t*)&y[0][i])[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
+      ((int16_t*)&y[0][i])[0] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
       e_ptr++;
-      ((int16_t*)&y[0][i])[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
+      ((int16_t*)&y[0][i])[1] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
       e_ptr++;
 
       // second antenna position n -> -x1*
-      ((int16_t*)&y[1][i])[0] = (*e_ptr == 1) ? gain_lin_QPSK : -gain_lin_QPSK;
+      ((int16_t*)&y[1][i])[0] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? gain_lin_QPSK : -gain_lin_QPSK;
       e_ptr++;
-      ((int16_t*)&y[1][i])[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
+      ((int16_t*)&y[1][i])[1] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
       e_ptr++;
 
       // fill in the rest of the ALAMOUTI precoding
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
index 06aa2656be32001cc08a37f24dcb05a50598ab20..0641d69de2e46e3d417fd3984ad3933329704784 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
@@ -361,8 +361,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
 
       else if (mimo_mode == ALAMOUTI) {
         *re_allocated = *re_allocated + 1;
-        // normalization for 2 tx antennas
-        amp = (int16_t)(((int32_t)tmp_amp*ONE_OVER_SQRT2_Q15)>>15);
 
         switch (mod_order0) {
         case 2:  //QPSK
@@ -417,8 +415,10 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
 
           *jj=*jj+1;
 
-          ((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
-          ((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
+          //((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
+          //((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
+	  ((int16_t *)&txdataF[0][tti_offset])[0]+=(qam_table_s0[qam16_table_offset_re]*ONE_OVER_SQRT2_Q15)>>15;
+	  ((int16_t *)&txdataF[0][tti_offset])[1]+=(qam_table_s0[qam16_table_offset_im]*ONE_OVER_SQRT2_Q15)>>15;
 
           // Antenna 1 position n Real part -> -x1*
 
@@ -446,8 +446,10 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
 
           *jj=*jj+1;
 
-          ((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
-          ((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
+          //((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
+          //((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
+	  ((int16_t *)&txdataF[1][tti_offset])[0]+=-(qam_table_s0[qam16_table_offset_re]*ONE_OVER_SQRT2_Q15)>>15;
+	  ((int16_t *)&txdataF[1][tti_offset])[1]+=(qam_table_s0[qam16_table_offset_im]*ONE_OVER_SQRT2_Q15)>>15;
 
 
           break;
@@ -488,8 +490,10 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
 
           *jj=*jj+1;
 
-          ((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
-          ((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
+          //((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
+          //((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
+	  ((int16_t *)&txdataF[0][tti_offset])[0]+=(qam_table_s0[qam64_table_offset_re]*ONE_OVER_SQRT2_Q15)>>15;
+	  ((int16_t *)&txdataF[0][tti_offset])[1]+=(qam_table_s0[qam64_table_offset_im]*ONE_OVER_SQRT2_Q15)>>15;
 
 
           // Antenna 1 => -x1*
@@ -526,8 +530,11 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
 
           *jj=*jj+1;
 
-          ((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
-          ((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
+          //((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
+          //((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
+	  ((int16_t *)&txdataF[1][tti_offset])[0]+=-(qam_table_s0[qam64_table_offset_re]*ONE_OVER_SQRT2_Q15)>>15;
+	  ((int16_t *)&txdataF[1][tti_offset])[1]+=(qam_table_s0[qam64_table_offset_im]*ONE_OVER_SQRT2_Q15)>>15;
+
 
           break;
         }
diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c
index 88ce57b93075c5088ed69534579098a3ba857608..82ad9ab00f18a23361b5e36b44a24af3107c543c 100644
--- a/openair1/PHY/LTE_TRANSPORT/pucch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pucch.c
@@ -1052,12 +1052,11 @@ uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB,
       if (fmt==pucch_format1b)
         *(1+payload) = (stat_im<0) ? 1 : 0;
     } else { // insufficient energy on PUCCH so NAK
-      *payload = 0;
       ((int16_t*)&phy_vars_eNB->pucch1ab_stats[UE_id][(subframe<<10) + (phy_vars_eNB->pucch1ab_stats_cnt[UE_id][subframe])])[0] = (int16_t)(stat_re);
       ((int16_t*)&phy_vars_eNB->pucch1ab_stats[UE_id][(subframe<<10) + (phy_vars_eNB->pucch1ab_stats_cnt[UE_id][subframe])])[1] = (int16_t)(stat_im);
       phy_vars_eNB->pucch1ab_stats_cnt[UE_id][subframe] = (phy_vars_eNB->pucch1ab_stats_cnt[UE_id][subframe]+1)&1023;
 
-      *payload = (stat_re<0) ? 1 : 0;
+      *payload = 0;
 
       if (fmt==pucch_format1b)
         *(1+payload) = 0;
diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c
index 2691257895bbca11dd3cdb903b12edba4395a765..8e19bd86dbf34323fa11f7d71e0a9c0f04979ec5 100644
--- a/openair1/SIMULATION/LTE_PHY/mbmssim.c
+++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c
@@ -56,69 +56,7 @@
 PHY_VARS_eNB *PHY_vars_eNB;
 PHY_VARS_UE *PHY_vars_UE;
 
-void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmission_mode,uint8_t extended_prefix_flag,lte_frame_type_t frame_type, uint16_t Nid_cell,uint8_t tdd_config,
-                    uint8_t N_RB_DL,uint8_t osf,uint32_t perfect_ce)
-{
-
-  LTE_DL_FRAME_PARMS *lte_frame_parms;
-
-
-  printf("Start lte_param_init\n");
-  PHY_vars_eNB = malloc(sizeof(PHY_VARS_eNB));
-  PHY_vars_UE = malloc(sizeof(PHY_VARS_UE));
-  //PHY_config = malloc(sizeof(PHY_CONFIG));
-  mac_xface = malloc(sizeof(MAC_xface));
-
-  srand(1);
-  randominit(1);
-  set_taus_seed(1);
-
-  lte_frame_parms = &(PHY_vars_eNB->lte_frame_parms);
-
-  lte_frame_parms->N_RB_DL            = N_RB_DL;   //50 for 10MHz and 25 for 5 MHz
-  lte_frame_parms->N_RB_UL            = N_RB_DL;
-  lte_frame_parms->Ncp                = extended_prefix_flag;
-  lte_frame_parms->Nid_cell           = Nid_cell;
-  lte_frame_parms->Nid_cell_mbsfn     = 1;
-  lte_frame_parms->nushift            = Nid_cell%6;
-  lte_frame_parms->nb_antennas_tx     = N_tx;
-  lte_frame_parms->nb_antennas_rx     = N_rx;
-  lte_frame_parms->phich_config_common.phich_resource         = oneSixth;
-  lte_frame_parms->tdd_config         = tdd_config;
-  lte_frame_parms->frame_type         = frame_type;
-  //  lte_frame_parms->Csrs = 2;
-  //  lte_frame_parms->Bsrs = 0;
-  //  lte_frame_parms->kTC = 0;44
-  //  lte_frame_parms->n_RRC = 0;
-  lte_frame_parms->mode1_flag = (transmission_mode == 1)? 1 : 0;
-
-  init_frame_parms(lte_frame_parms,osf);
-
-  //copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
 
-  PHY_vars_UE->is_secondary_ue = 0;
-  PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
-  PHY_vars_eNB->lte_frame_parms = *lte_frame_parms;
-
-  phy_init_lte_top(lte_frame_parms);
-  dump_frame_parms(lte_frame_parms);
-
-  PHY_vars_UE->PHY_measurements.n_adj_cells=2;
-  PHY_vars_UE->PHY_measurements.adj_cell_id[0] = Nid_cell+1;
-  PHY_vars_UE->PHY_measurements.adj_cell_id[1] = Nid_cell+2;
-
-  lte_gold_mbsfn(lte_frame_parms,PHY_vars_UE->lte_gold_mbsfn_table,Nid_cell);
-  lte_gold_mbsfn(lte_frame_parms,PHY_vars_eNB->lte_gold_mbsfn_table,Nid_cell);
-
-  phy_init_lte_ue(PHY_vars_UE,1,0);
-  phy_init_lte_eNB(PHY_vars_eNB,0,0,0);
-
-
-  PHY_vars_UE->perfect_ce = perfect_ce;
-  printf("Done lte_param_init\n");
-
-
-}
 DCI1E_5MHz_2A_M10PRB_TDD_t  DLSCH_alloc_pdu2_1E[2];
 #define UL_RB_ALLOC 0x1ff;
 #define CCCH_RB_ALLOC computeRIV(PHY_vars_eNB->lte_frame_parms.N_RB_UL,0,2)
@@ -315,7 +253,7 @@ int main(int argc, char **argv)
   if (transmission_mode==2)
     n_tx=2;
 
-  lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,tdd_config,N_RB_DL,osf,perfect_ce);
+  lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,tdd_config,N_RB_DL,0,osf,perfect_ce);
 
 
 
diff --git a/openair1/SIMULATION/LTE_PHY/pbchsim.c b/openair1/SIMULATION/LTE_PHY/pbchsim.c
index 4a2b3f935120036e29ed1405f4a865720123e98d..b25b45cf14cfb6de567dab76550288e55359d44e 100644
--- a/openair1/SIMULATION/LTE_PHY/pbchsim.c
+++ b/openair1/SIMULATION/LTE_PHY/pbchsim.c
@@ -340,7 +340,7 @@ int main(int argc, char **argv)
   if (transmission_mode>=2)
     n_tx=2;
 
-  lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,N_RB_DL,osf);
+  lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,3,N_RB_DL,0,osf,0);
 
   PHY_vars_eNB1 = malloc(sizeof(PHY_VARS_eNB));
   PHY_vars_eNB2 = malloc(sizeof(PHY_VARS_eNB));
diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c
index 4691875d3a6c132084ef23b3a4b82f4109c80d90..655a7e2b62a3a8071520a3afacf4d7e2d5db17cf 100644
--- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c
+++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c
@@ -43,7 +43,6 @@
 #include "LAYER2/MAC/vars.h"
 #include "OCG_vars.h"
 
-
 #ifdef XFORMS
 #include "PHY/TOOLS/lte_phy_scope.h"
 #endif
@@ -57,15 +56,17 @@ PHY_VARS_UE *PHY_vars_UE;
 #define CCCH_RB_ALLOC computeRIV(PHY_vars_eNB->lte_frame_parms.N_RB_UL,0,2)
 #define DLSCH_RB_ALLOC ((uint16_t)0x1fbf) // igore DC component,RB13
 
+#define msg printf
+
 DCI_PDU DCI_pdu;
 
-DCI_PDU *get_dci(LTE_DL_FRAME_PARMS *lte_frame_parms,uint8_t log2L, uint8_t log2Lcommon, uint8_t format_selector, uint32_t rnti)
+DCI_PDU *get_dci(LTE_DL_FRAME_PARMS *lte_frame_parms,uint8_t log2L, uint8_t log2Lcommon, DCI_format_t format_selector[MAX_NUM_DCI], uint8_t num_dci, uint32_t rnti)
 {
   uint32_t BCCH_alloc_pdu[2];
   uint32_t DLSCH_alloc_pdu[2];
   uint32_t UL_alloc_pdu[2];
 
-  int i;
+  int ind;
   int dci_length_bytes=0,dci_length=0;
   int BCCH_pdu_size_bits=0, BCCH_pdu_size_bytes=0;
   int UL_pdu_size_bits=0, UL_pdu_size_bytes=0;
@@ -360,39 +361,39 @@ DCI_PDU *get_dci(LTE_DL_FRAME_PARMS *lte_frame_parms,uint8_t log2L, uint8_t log2
     }
   }
 
+  for (ind = 0; ind<num_dci; ind++) {
+  if (format_selector[ind]==format1A) {
+    // add common dci
+    DCI_pdu.dci_alloc[ind].dci_length = BCCH_pdu_size_bits;
+    DCI_pdu.dci_alloc[ind].L          = log2Lcommon;
+    DCI_pdu.dci_alloc[ind].rnti       = SI_RNTI;
+    DCI_pdu.dci_alloc[ind].format     = format1A;
+    DCI_pdu.dci_alloc[ind].ra_flag    = 0;
+    memcpy((void*)&DCI_pdu.dci_alloc[0].dci_pdu[0], &BCCH_alloc_pdu[0], BCCH_pdu_size_bytes);
+    DCI_pdu.Num_common_dci++;
+  }
 
-  // add common dci
-  DCI_pdu.dci_alloc[0].dci_length = BCCH_pdu_size_bits;
-  DCI_pdu.dci_alloc[0].L          = log2Lcommon;
-  DCI_pdu.dci_alloc[0].rnti       = SI_RNTI;
-  DCI_pdu.dci_alloc[0].format     = format1A;
-  DCI_pdu.dci_alloc[0].ra_flag    = 0;
-  memcpy((void*)&DCI_pdu.dci_alloc[0].dci_pdu[0], &BCCH_alloc_pdu[0], BCCH_pdu_size_bytes);
-  DCI_pdu.Num_common_dci++;
-  if (lte_frame_parms->N_RB_DL >= 25) {
-  // add ue specific dci
-    DCI_pdu.dci_alloc[1].dci_length = dci_length;
-    DCI_pdu.dci_alloc[1].L          = log2L;
-    DCI_pdu.dci_alloc[1].rnti       = rnti;
-    DCI_pdu.dci_alloc[1].format     = format1;
-    DCI_pdu.dci_alloc[1].ra_flag    = 0;
-    memcpy((void*)&DCI_pdu.dci_alloc[1].dci_pdu[0], &DLSCH_alloc_pdu[0], dci_length_bytes);
+  if (format_selector[ind]==format1) {
+    // add ue specific dci
+    DCI_pdu.dci_alloc[ind].dci_length = dci_length;
+    DCI_pdu.dci_alloc[ind].L          = log2L;
+    DCI_pdu.dci_alloc[ind].rnti       = rnti;
+    DCI_pdu.dci_alloc[ind].format     = format1;
+    DCI_pdu.dci_alloc[ind].ra_flag    = 0;
+    memcpy((void*)&DCI_pdu.dci_alloc[ind].dci_pdu[0], &DLSCH_alloc_pdu[0], dci_length_bytes);
     DCI_pdu.Num_ue_spec_dci++;
-
-    if (lte_frame_parms->N_RB_DL >= 50) {
-      DCI_pdu.dci_alloc[2].dci_length = UL_pdu_size_bits;
-      DCI_pdu.dci_alloc[2].L          = log2L;
-      DCI_pdu.dci_alloc[2].rnti       = rnti;
-      DCI_pdu.dci_alloc[2].format     = format0;
-      DCI_pdu.dci_alloc[2].ra_flag    = 0;
-      memcpy((void*)&DCI_pdu.dci_alloc[0].dci_pdu[0], &UL_alloc_pdu[0], UL_pdu_size_bytes);
+  }
+ 
+  if (format_selector[ind]==format0) {
+      DCI_pdu.dci_alloc[ind].dci_length = UL_pdu_size_bits;
+      DCI_pdu.dci_alloc[ind].L          = log2L;
+      DCI_pdu.dci_alloc[ind].rnti       = rnti;
+      DCI_pdu.dci_alloc[ind].format     = format0;
+      DCI_pdu.dci_alloc[ind].ra_flag    = 0;
+      memcpy((void*)&DCI_pdu.dci_alloc[ind].dci_pdu[0], &UL_alloc_pdu[0], UL_pdu_size_bytes);
       DCI_pdu.Num_ue_spec_dci++;
-    }
   }
-
-
-
-
+  }
   
   return(&DCI_pdu);
 }
@@ -428,7 +429,9 @@ int main(int argc, char **argv)
   //  int8_t interf1=-128,interf2=-128;
   uint8_t dci_cnt=0;
   LTE_DL_FRAME_PARMS *frame_parms;
-  uint8_t log2L=2, log2Lcommon=2, format_selector=0;
+  uint8_t log2L=2, log2Lcommon=2;
+  DCI_format_t format_selector[MAX_NUM_DCI];
+  uint8_t num_dci=0;
   uint8_t numCCE,common_active=0,ul_active=0,dl_active=0;
 
   uint32_t n_trials_common=0,n_trials_ul=0,n_trials_dl=0,false_detection_cnt=0;
@@ -470,6 +473,11 @@ int main(int argc, char **argv)
     rxdata[0] = (int *)malloc16(FRAME_LENGTH_BYTES);
     rxdata[1] = (int *)malloc16(FRAME_LENGTH_BYTES);
   */
+
+
+  logInit();
+
+
   while ((c = getopt (argc, argv, "hapFg:R:c:n:s:x:y:z:L:M:N:I:f:i:S:P:Y")) != -1) {
     switch (c) {
     case 'a':
@@ -613,7 +621,15 @@ int main(int argc, char **argv)
       break;
 
     case 'N':
-      format_selector = atoi(optarg);
+      format_selector[num_dci] = (DCI_format_t) atoi(optarg);
+      if ((format_selector[num_dci]<format0) || (format_selector[num_dci] > format1A)) {
+	printf("only formats 0, 1, and 1A supported for the moment\n");
+	exit(-1);
+      }
+      if (format_selector[num_dci]==format0) ul_active=1;
+      if (format_selector[num_dci]==format1A) common_active=1;
+      if (format_selector[num_dci]==format1) dl_active=1;
+      num_dci++;
       break;
 
     case 'O':
@@ -663,25 +679,27 @@ int main(int argc, char **argv)
       printf("-y Number of TX antennas used in eNB\n");
       printf("-z Number of RX antennas used in UE\n");
       printf("-P Number of interfering PHICH\n");
-      printf("-L log2 of Aggregation level for UE Specific DCI (1,2,4,8)\n");
+      printf("-L log2 of Aggregation level for UE Specific DCI (0,1,2,3)\n");
       printf("-M log2 Aggregation level for Common DCI (4,8)\n");
-      printf("-N Format for UE Spec DCI (0 - format1,\n");
-      printf("                           1 - format1A,\n");
-      printf("                           2 - format1B_2A,\n");
-      printf("                           3 - format1B_4A,\n");
-      printf("                           4 - format1C,\n");
-      printf("                           5 - format1D_2A,\n");
-      printf("                           6 - format1D_4A,\n");
-      printf("                           7 - format2A_2A_L10PRB,\n");
-      printf("                           8 - format2A_2A_M10PRB,\n");
-      printf("                           9 - format2A_4A_L10PRB,\n");
-      printf("                          10 - format2A_4A_M10PRB,\n");
-      printf("                          11 - format2_2A_L10PRB,\n");
-      printf("                          12 - format2_2A_M10PRB,\n");
-      printf("                          13 - format2_4A_L10PRB,\n");
-      printf("                          14 - format2_4A_M10PRB\n");
-      printf("                          15 - format2_2D_M10PRB\n");
-      printf("                          16 - format2_2D_L10PRB\n");
+      printf("-N Format for UE Spec DCI (0 - format0,\n");
+      printf("                           1 - format1,\n");
+      printf("                           2 - format1A,\n");
+      printf("                           3 - format1B_2A,\n");
+      printf("                           4 - format1B_4A,\n");
+      printf("                           5 - format1C,\n");
+      printf("                           6 - format1D_2A,\n");
+      printf("                           7 - format1D_4A,\n");
+      printf("                           8 - format2A_2A_L10PRB,\n");
+      printf("                           9 - format2A_2A_M10PRB,\n");
+      printf("                          10 - format2A_4A_L10PRB,\n");
+      printf("                          11 - format2A_4A_M10PRB,\n");
+      printf("                          12 - format2_2A_L10PRB,\n");
+      printf("                          13 - format2_2A_M10PRB,\n");
+      printf("                          14 - format2_4A_L10PRB,\n");
+      printf("                          15 - format2_4A_M10PRB\n");
+      printf("                          16 - format2_2D_M10PRB\n");
+      printf("                          17 - format2_2D_L10PRB\n");
+      printf("   can be called multiple times to add more than one DCI\n");
       printf("-O Oversampling factor\n");
       printf("-I Cell Id\n");
       printf("-F Input sample stream\n");
@@ -690,11 +708,6 @@ int main(int argc, char **argv)
     }
   }
 
-
-
-
-  logInit();
-
   if ((transmission_mode>1) && (n_tx==1))
     n_tx=2;
 
@@ -730,7 +743,7 @@ int main(int argc, char **argv)
   printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
 
   frame_parms = &PHY_vars_eNB->lte_frame_parms;
-  get_dci(frame_parms, log2L, log2Lcommon, format_selector, n_rnti);
+  get_dci(frame_parms, log2L, log2Lcommon, format_selector, num_dci, n_rnti);
 
   txdata = PHY_vars_eNB->lte_eNB_common_vars.txdata[eNb_id];
 
@@ -864,15 +877,14 @@ int main(int argc, char **argv)
 
       if (input_fd == NULL) {
         numCCE=0;
-        n_trials_common++;
-        common_active = 1;
-	if (PHY_vars_eNB->lte_frame_parms.N_RB_DL >= 50) { 
+        if (common_active==1) { 
+	  n_trials_common++;
+	}
+	if (ul_active==1) { 
 	  n_trials_ul++;
-	  ul_active = 1;
 	}
-        if (PHY_vars_eNB->lte_frame_parms.N_RB_DL >= 25) { 
+        if (dl_active==1) { 
 	  n_trials_dl++;
-	  dl_active = 1; 
 	}
 
         num_pdcch_symbols = get_num_pdcch_symbols(DCI_pdu.Num_common_dci+DCI_pdu.Num_ue_spec_dci,
@@ -918,8 +930,8 @@ int main(int argc, char **argv)
           }
 
           if (n_frames==1)
-            printf("dci %d: rnti 0x%x, format %d, L %d, nCCE %d/%d dci_length %d\n",i,DCI_pdu.dci_alloc[i].rnti, DCI_pdu.dci_alloc[i].format,
-                   DCI_pdu.dci_alloc[i].L, DCI_pdu.dci_alloc[i].firstCCE, numCCE, DCI_pdu.dci_alloc[i].dci_length);
+            printf("dci %d: rnti 0x%x, format %d, L %d (aggreg %d), nCCE %d/%d dci_length %d\n",i,DCI_pdu.dci_alloc[i].rnti, DCI_pdu.dci_alloc[i].format,
+                   DCI_pdu.dci_alloc[i].L, 1<<DCI_pdu.dci_alloc[i].L, DCI_pdu.dci_alloc[i].firstCCE, numCCE, DCI_pdu.dci_alloc[i].dci_length);
 
           if (DCI_pdu.dci_alloc[i].firstCCE==-1)
             exit(-1);
@@ -1236,7 +1248,7 @@ int main(int argc, char **argv)
 
     } //trials
 
-    printf("SNR %f : n_errors_common = %d/%d (%e)\n", SNR,n_errors_common,n_trials_common,(double)n_errors_common/n_trials_common);
+    if (common_active) printf("SNR %f : n_errors_common = %d/%d (%e)\n", SNR,n_errors_common,n_trials_common,(double)n_errors_common/n_trials_common);
     if (ul_active==1) printf("SNR %f : n_errors_ul = %d/%d (%e)\n", SNR,n_errors_ul,n_trials_ul,(double)n_errors_ul/n_trials_ul);
     if (dl_active==1) printf("SNR %f : n_errors_dl = %d/%d (%e)\n", SNR,n_errors_dl,n_trials_dl,(double)n_errors_dl/n_trials_dl);
     printf("SNR %f : n_errors_cfi = %d/%d (%e)\n", SNR,n_errors_cfi,trial,(double)n_errors_cfi/trial);
diff --git a/openair1/SIMULATION/LTE_PHY/pucchsim.c b/openair1/SIMULATION/LTE_PHY/pucchsim.c
index c5b356918807a49f9f5acdaf3e7a798d73a677d1..614cad48989e34112fd0484a4743c6a937fbe50d 100644
--- a/openair1/SIMULATION/LTE_PHY/pucchsim.c
+++ b/openair1/SIMULATION/LTE_PHY/pucchsim.c
@@ -311,10 +311,11 @@ int main(int argc, char **argv)
 		 n_rx,
 		 transmission_mode,
 		 extended_prefix_flag,
-		 Nid_cell,
 		 FDD,
+		 Nid_cell,
 		 3,
 		 N_RB_DL,
+		 0,
 		 osf,
 		 0);
 
diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h
index 6f7722316fcdbe4d51e7442fff87459fd031d111..670b191c0ba7b10a8d1d690c302bfbce5ab4e8fd 100755
--- a/openair2/COMMON/platform_types.h
+++ b/openair2/COMMON/platform_types.h
@@ -215,6 +215,7 @@ typedef struct protocol_ctxt_s {
   frame_t     frame;         /*!< \brief  LTE frame number.*/
   sub_frame_t subframe;      /*!< \brief  LTE sub frame number.*/
   eNB_index_t eNB_index;     /*!< \brief  valid for UE indicating the index of connected eNB(s)      */
+  boolean_t   configured;  /*!< \brief  flag indicating whether the instance is configured or not  */
 } protocol_ctxt_t;
 // warning time hardcoded
 #define PROTOCOL_CTXT_TIME_MILLI_SECONDS(CtXt_h) ((CtXt_h)->frame*10+(CtXt_h)->subframe)
diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h
index 816b9368952c08bfd9ffe6d01fd0ad3ce49fe100..ffe194265fd2413be9894fdfb4e384b6b7997fd7 100644
--- a/openair2/COMMON/rrc_messages_types.h
+++ b/openair2/COMMON/rrc_messages_types.h
@@ -179,7 +179,7 @@ typedef struct RrcConfigurationReq_s {
   long                    ue_TimersAndConstants_t311[MAX_NUM_CCs];
   long                    ue_TimersAndConstants_n310[MAX_NUM_CCs];
   long                    ue_TimersAndConstants_n311[MAX_NUM_CCs];
-
+  long                    ue_TransmissionMode[MAX_NUM_CCs];
 } RrcConfigurationReq;
 
 // UE: NAS -> RRC messages
diff --git a/openair2/COMMON/s1ap_messages_def.h b/openair2/COMMON/s1ap_messages_def.h
index ce51ac78cad021f60a16bd746fdafc20e561e39f..e2012a91c5e871ac1d5d7830e41e1fd565f72da6 100644
--- a/openair2/COMMON/s1ap_messages_def.h
+++ b/openair2/COMMON/s1ap_messages_def.h
@@ -39,6 +39,8 @@ MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_REQ_LOG, MESSAGE_PRIORITY_MED, IttiMsgText
 MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMMAND_LOG, MESSAGE_PRIORITY_MED, IttiMsgText                  , s1ap_ue_context_release_command_log)
 MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG, MESSAGE_PRIORITY_MED, IttiMsgText                 , s1ap_ue_context_release_complete_log)
 MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_LOG    , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_ue_context_release_log)
+MESSAGE_DEF(S1AP_E_RAB_SETUP_REQUEST_LOG    , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_e_rab_setup_request_log)
+MESSAGE_DEF(S1AP_E_RAB_SETUP_RESPONSE_LOG    , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_e_rab_setup_response_log)
 
 /* eNB application layer -> S1AP messages */
 MESSAGE_DEF(S1AP_REGISTER_ENB_REQ          , MESSAGE_PRIORITY_MED, s1ap_register_enb_req_t          , s1ap_register_enb_req)
@@ -58,12 +60,15 @@ MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_RESP   , MESSAGE_PRIORITY_MED, s1ap_ue_relea
 MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMPLETE, MESSAGE_PRIORITY_MED, s1ap_ue_release_complete_t      , s1ap_ue_release_complete)
 MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_RESP , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_modification_resp_t , s1ap_ue_ctxt_modification_resp)
 MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_FAIL , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_modification_fail_t , s1ap_ue_ctxt_modification_fail)
+MESSAGE_DEF(S1AP_E_RAB_SETUP_RESP          , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_resp_t          , s1ap_e_rab_setup_resp)
+MESSAGE_DEF(S1AP_E_RAB_SETUP_REQUEST_FAIL  , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_req_fail_t      , s1ap_e_rab_setup_request_fail)
 
 /* S1AP -> RRC messages */
 MESSAGE_DEF(S1AP_DOWNLINK_NAS              , MESSAGE_PRIORITY_MED, s1ap_downlink_nas_t              , s1ap_downlink_nas )
 MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, s1ap_initial_context_setup_req_t , s1ap_initial_context_setup_req )
 MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_REQ  , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_modification_req_t  , s1ap_ue_ctxt_modification_req)
 MESSAGE_DEF(S1AP_PAGING_IND                , MESSAGE_PRIORITY_MED, s1ap_paging_ind_t                , s1ap_paging_ind )
+MESSAGE_DEF(S1AP_E_RAB_SETUP_REQ            , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_req_t        , s1ap_e_rab_setup_req )
 MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMMAND, MESSAGE_PRIORITY_MED, s1ap_ue_release_command_t        , s1ap_ue_release_command)
 
 /* S1AP <-> RRC messages (can be initiated either by MME or eNB) */
diff --git a/openair2/COMMON/s1ap_messages_types.h b/openair2/COMMON/s1ap_messages_types.h
index f2c6a2a3a27222fb17c7f263c20963e881ef08d1..56091c0c368ba7c7900e63d227af7c7e8aaf3af1 100644
--- a/openair2/COMMON/s1ap_messages_types.h
+++ b/openair2/COMMON/s1ap_messages_types.h
@@ -47,12 +47,15 @@
 #define S1AP_NAS_NON_DELIVERY_IND(mSGpTR)       (mSGpTR)->ittiMsg.s1ap_nas_non_delivery_ind
 #define S1AP_UE_CTXT_MODIFICATION_RESP(mSGpTR)  (mSGpTR)->ittiMsg.s1ap_ue_ctxt_modification_resp
 #define S1AP_UE_CTXT_MODIFICATION_FAIL(mSGpTR)  (mSGpTR)->ittiMsg.s1ap_ue_ctxt_modification_fail
+#define S1AP_E_RAB_SETUP_RESP(mSGpTR)           (mSGpTR)->ittiMsg.s1ap_e_rab_setup_resp
+#define S1AP_E_RAB_SETUP_FAIL(mSGpTR)           (mSGpTR)->ittiMsg.s1ap_e_rab_setup_req_fail
 
 #define S1AP_DOWNLINK_NAS(mSGpTR)               (mSGpTR)->ittiMsg.s1ap_downlink_nas
 #define S1AP_INITIAL_CONTEXT_SETUP_REQ(mSGpTR)  (mSGpTR)->ittiMsg.s1ap_initial_context_setup_req
 #define S1AP_UE_CTXT_MODIFICATION_REQ(mSGpTR)   (mSGpTR)->ittiMsg.s1ap_ue_ctxt_modification_req
 #define S1AP_UE_CONTEXT_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_command
 #define S1AP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_complete
+#define S1AP_E_RAB_SETUP_REQ(mSGpTR)              (mSGpTR)->ittiMsg.s1ap_e_rab_setup_req
 #define S1AP_PAGIND_IND(mSGpTR)                 (mSGpTR)->ittiMsg.s1ap_paging_ind
 
 #define S1AP_UE_CONTEXT_RELEASE_REQ(mSGpTR)     (mSGpTR)->ittiMsg.s1ap_ue_release_req
@@ -390,7 +393,7 @@ typedef struct s1ap_initial_context_setup_fail_s {
   unsigned  eNB_ue_s1ap_id:24;
 
   /* TODO add cause */
-} s1ap_initial_context_setup_fail_t, s1ap_ue_ctxt_modification_fail_t;
+} s1ap_initial_context_setup_fail_t, s1ap_ue_ctxt_modification_fail_t, s1ap_e_rab_setup_req_fail_t;
 
 typedef struct s1ap_nas_non_delivery_ind_s {
   unsigned  eNB_ue_s1ap_id:24;
@@ -439,6 +442,7 @@ typedef struct s1ap_downlink_nas_s {
   nas_pdu_t nas_pdu;
 } s1ap_downlink_nas_t;
 
+
 typedef struct s1ap_initial_context_setup_req_s {
   /* UE id for initial connection to S1AP */
   uint16_t ue_initial_id;
@@ -479,6 +483,39 @@ typedef struct s1ap_paging_ind_s {
   paging_priority_t paging_priority;
 } s1ap_paging_ind_t;
 
+typedef struct s1ap_e_rab_setup_req_s {
+  /* UE id for initial connection to S1AP */
+  uint16_t ue_initial_id;
+
+  /* MME UE id  */
+  uint16_t mme_ue_s1ap_id;
+
+  /* eNB ue s1ap id as initialized by S1AP layer */
+  unsigned eNB_ue_s1ap_id:24;
+
+  /* Number of e_rab to be setup in the list */
+  uint8_t nb_e_rabs_tosetup;
+
+  /* E RAB setup request */
+  e_rab_t e_rab_setup_params[S1AP_MAX_E_RAB];
+
+} s1ap_e_rab_setup_req_t;
+
+typedef struct s1ap_e_rab_setup_resp_s {
+  unsigned  eNB_ue_s1ap_id:24;
+
+  /* Number of e_rab setup-ed in the list */
+  uint8_t       nb_of_e_rabs;
+  /* list of e_rab setup-ed by RRC layers */
+  e_rab_setup_t e_rabs[S1AP_MAX_E_RAB];
+
+  /* Number of e_rab failed to be setup in list */
+  uint8_t        nb_of_e_rabs_failed;
+  /* list of e_rabs that failed to be setup */
+  e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB];
+} s1ap_e_rab_setup_resp_t;
+
+
 // S1AP --> RRC messages
 typedef struct s1ap_ue_release_command_s {
 
diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c
index dc21448aef907806997c1ba067cd3207fec7e560..fa3573b494af94045a30386dd0e6c8c9c7b46607 100644
--- a/openair2/ENB_APP/enb_app.c
+++ b/openair2/ENB_APP/enb_app.c
@@ -191,6 +191,9 @@ static void configure_rrc(uint32_t enb_id, const Enb_properties_array_t *enb_pro
     RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[CC_id]               = enb_properties->properties[enb_id]->ue_TimersAndConstants_n310[CC_id];
     RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[CC_id]               = enb_properties->properties[enb_id]->ue_TimersAndConstants_t311[CC_id];
     RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[CC_id]               = enb_properties->properties[enb_id]->ue_TimersAndConstants_n311[CC_id];
+
+    RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[CC_id]                      = enb_properties->properties[enb_id]->ue_TransmissionMode[CC_id];
+
   }
 
   itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
@@ -259,6 +262,8 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end, con
       str = inet_ntoa(addr);
       strcpy(s1ap_register_eNB->enb_ip_address.ipv4_address, str);
 
+      LOG_I(ENB_APP,"[eNB %d] eNB_app_register for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id));
+
       itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
 
       register_enb_pending++;
diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index cd15045dd8e2285a5a49ab81977bbb9f91bc2830..4a44a39a0b1f9f9a224969072afe0208c05aa6e8 100755
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -84,6 +84,7 @@
 #define ENB_CONFIG_STRING_NID_CELL                                      "Nid_cell"
 #define ENB_CONFIG_STRING_N_RB_DL                                       "N_RB_DL"
 #define ENB_CONFIG_STRING_CELL_MBSFN                                  "Nid_cell_mbsfn"
+#define ENB_CONFIG_STRING_NB_ANT_PORTS                              "nb_antenna_ports"
 #define ENB_CONFIG_STRING_NB_ANT_TX                                 "nb_antennas_tx"
 #define ENB_CONFIG_STRING_NB_ANT_RX                                 "nb_antennas_rx"
 #define ENB_CONFIG_STRING_TX_GAIN                                       "tx_gain"
@@ -145,6 +146,7 @@
 #define ENB_CONFIG_STRING_UETIMERS_T311                                 "ue_TimersAndConstants_t311"
 #define ENB_CONFIG_STRING_UETIMERS_N310                                 "ue_TimersAndConstants_n310"
 #define ENB_CONFIG_STRING_UETIMERS_N311                                 "ue_TimersAndConstants_n311"
+#define ENB_CONFIG_STRING_UE_TRANSMISSION_MODE                          "ue_TransmissionMode"
 
 #define ENB_CONFIG_STRING_SRB1                                          "srb1_parameters"
 #define ENB_CONFIG_STRING_SRB1_TIMER_POLL_RETRANSMIT                    "timer_poll_retransmit"
@@ -337,6 +339,7 @@ void enb_config_display(void)
 
       printf( "\n\tCell ID for CC %d:\t%"PRId16":\n",j,enb_properties.properties[i]->Nid_cell[j]);
       printf( "\tN_RB_DL for CC %d:\t%"PRId16":\n",j,enb_properties.properties[i]->N_RB_DL[j]);
+      printf( "\tnb_antenna_ports for CC %d:\t%d:\n",j,enb_properties.properties[i]->nb_antenna_ports[j]);
       printf( "\tnb_antennas_tx for CC %d:\t%d:\n",j,enb_properties.properties[i]->nb_antennas_tx[j]);
       printf( "\tnb_antennas_rx for CC %d:\t%d:\n",j,enb_properties.properties[i]->nb_antennas_rx[j]);
 
@@ -426,6 +429,8 @@ void enb_config_display(void)
       printf( "\tue_TimersAndConstants_t311 for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ue_TimersAndConstants_t311[j]);
       printf( "\tue_TimersAndConstants_n311 for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ue_TimersAndConstants_n311[j]);
 
+      printf( "\tue_TransmissionMode for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ue_TransmissionMode[j]);
+
     }
 
     for (j=0; j < enb_properties.properties[i]->num_otg_elements; j++) {
@@ -541,6 +546,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
   libconfig_int     Nid_cell                      = 0;
   libconfig_int     Nid_cell_mbsfn                = 0;
   libconfig_int     N_RB_DL                       = 0;
+  libconfig_int     nb_antenna_ports              = 0;
   libconfig_int     nb_antennas_tx                = 0;
   libconfig_int     nb_antennas_rx                = 0;
   libconfig_int     tx_gain                       = 0;
@@ -604,7 +610,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
   libconfig_int     ue_TimersAndConstants_t311    = 0;
   libconfig_int     ue_TimersAndConstants_n310    = 0;
   libconfig_int     ue_TimersAndConstants_n311    = 0;
-
+  libconfig_int     ue_TransmissionMode           = 0;
 
 
   libconfig_int     srb1_timer_poll_retransmit    = 0;
@@ -816,6 +822,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_NID_CELL, &Nid_cell)
                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_N_RB_DL, &N_RB_DL)
                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_CELL_MBSFN, &Nid_cell_mbsfn)
+                   && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_NB_ANT_PORTS, &nb_antenna_ports)
                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_NB_ANT_TX, &nb_antennas_tx)
                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_NB_ANT_RX, &nb_antennas_rx)
                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_TX_GAIN, &tx_gain)
@@ -871,6 +878,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UETIMERS_T311,  &ue_TimersAndConstants_t311)
                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UETIMERS_N310,  &ue_TimersAndConstants_n310)
                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UETIMERS_N311,  &ue_TimersAndConstants_n311)
+                   && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UE_TRANSMISSION_MODE,  &ue_TransmissionMode)
 
 #ifdef Rel10
 
@@ -987,7 +995,14 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
 
               enb_properties.properties[enb_properties_index]->nb_antennas_tx[j] = nb_antennas_tx;
 
-              if ((nb_antennas_tx <1) || (nb_antennas_tx > 4))
+              if ((nb_antenna_ports <1) || (nb_antenna_ports > 2))
+                AssertError (0, parse_errors ++,
+                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antenna_ports choice: 1..2 !\n",
+                             lib_config_file_name_pP, i, nb_antenna_ports);
+
+              enb_properties.properties[enb_properties_index]->nb_antenna_ports[j] = nb_antenna_ports;
+
+              if ((nb_antennas_tx <1) || (nb_antennas_tx > 64))
                 AssertError (0, parse_errors ++,
                              "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antennas_tx choice: 1..4 !\n",
                              lib_config_file_name_pP, i, nb_antennas_tx);
@@ -1851,6 +1866,35 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
                 break;
 
               }
+
+	      switch (ue_TransmissionMode) {
+	      case 1:
+		enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm1;
+		break;
+	      case 2:
+		enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm2;
+		break;
+	      case 3:
+		enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm3;
+		break;
+	      case 4:
+		enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm4;
+		break;
+	      case 5:
+		enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm5;
+		break;
+	      case 6:
+		enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm6;
+		break;
+	      case 7:
+		enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm7;
+		break;
+	      default:
+                AssertError (0, parse_errors ++,
+                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TransmissionMode choice: 1,2,3,4,5,6,7",
+                             lib_config_file_name_pP, i, ue_TransmissionMode);
+		break;
+	      }
             }
           }
 
diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h
index dd62ab9fd944492107391c741275fa6a85da5235..d9e93496207deda7b58bf1fe80473311b00a841d 100755
--- a/openair2/ENB_APP/enb_config.h
+++ b/openair2/ENB_APP/enb_config.h
@@ -136,9 +136,10 @@ typedef struct Enb_properties_s {
 
   int16_t                 Nid_cell[1+MAX_NUM_CCs];// for testing, change later
   int16_t                 N_RB_DL[1+MAX_NUM_CCs];// for testing, change later
-  int                   nb_antennas_tx[1+MAX_NUM_CCs];
+  int                     nb_antenna_ports[1+MAX_NUM_CCs];
+  int                     nb_antennas_tx[1+MAX_NUM_CCs];
   int                     nb_antennas_rx[1+MAX_NUM_CCs];
-  int                   tx_gain[1+MAX_NUM_CCs];
+  int                     tx_gain[1+MAX_NUM_CCs];
   int                     rx_gain[1+MAX_NUM_CCs];
   long                    prach_root[1+MAX_NUM_CCs];
   long                    prach_config_index[1+MAX_NUM_CCs];
@@ -198,7 +199,7 @@ typedef struct Enb_properties_s {
   long                    ue_TimersAndConstants_t311[1+MAX_NUM_CCs];
   long                    ue_TimersAndConstants_n310[1+MAX_NUM_CCs];
   long                    ue_TimersAndConstants_n311[1+MAX_NUM_CCs];
-
+  long                    ue_TransmissionMode[1+MAX_NUM_CCs];
 
   long                    srb1_timer_poll_retransmit;
   long                    srb1_timer_reordering;
diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h
index 2793edcfccfec2e100ff250500575332d614265e..44fb5c6e4fdd3a274fd47c7dd1f0420c54911c12 100644
--- a/openair2/LAYER2/MAC/defs.h
+++ b/openair2/LAYER2/MAC/defs.h
@@ -913,7 +913,7 @@ typedef struct {
   /// CCE table used to build DCI scheduling information
   int CCE_table[MAX_NUM_CCs][800];
   ///  active flag for Other lcid
-  //  uint8_t lcid_active[NB_RB_MAX];
+  uint8_t lcid_active[NB_RB_MAX];
   /// eNB stats
   eNB_STATS eNB_stats[MAX_NUM_CCs];
   // MAC function execution peformance profiler
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
index 473be941c69e1166fce5ee4010634bc95a93c8e6..bd1048831bfe0d54eaeacf9bb9b7bfddecbc7640 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
@@ -68,6 +68,7 @@
 
 #include "SIMULATION/TOOLS/defs.h" // for taus
 
+#include "T.h"
 
 void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,unsigned char Msg3_subframe)
 {
@@ -644,6 +645,9 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un
 		     &eNB->common_channels[CC_id].CCCH_pdu.payload[0],
 		     rrc_sdu_length);
 	      
+              T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(RA_template->rnti), T_INT(frameP), T_INT(subframeP),
+                T_INT(0 /*harq_pid always 0?*/), T_BUFFER(&eNB->UE_list.DLSCH_pdu[CC_id][0][UE_id].payload[0], TBsize));
+
 	      if (opt_enabled==1) {
 		trace_pdu(1, (uint8_t *)eNB->UE_list.DLSCH_pdu[CC_id][0][(unsigned char)UE_id].payload[0],
 			  rrc_sdu_length, UE_id, 3, UE_RNTI(module_idP, UE_id),
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
index 81e1df4dc52457d55724e3ab378951ec3270e916..61a035769169d497a64d467d2f7070599e11464d 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
@@ -434,10 +434,12 @@ schedule_ue_spec(
   int                   N_RBG[MAX_NUM_CCs];
   unsigned char         aggregation;
   mac_rlc_status_resp_t rlc_status;
-  unsigned char         header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0;
-  unsigned char         sdu_lcids[11],offset,num_sdus=0;
+  unsigned char         header_len_dcch=0, header_len_dcch_tmp=0, header_len_dcch_last=0; 
+  unsigned char         header_len_dtch=0, header_len_dtch_tmp=0, header_len_dtch_last=0; 
+  unsigned char         ta_len=0;
+  unsigned char         sdu_lcids[NB_RB_MAX],lcid,offset,num_sdus=0;
   uint16_t              nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb;
-  uint16_t              TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0;
+  uint16_t              TBS,j,sdu_lengths[NB_RB_MAX],rnti,padding=0,post_padding=0;
   unsigned char         dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES];
   unsigned char         round            = 0;
   unsigned char         harq_pid         = 0;
@@ -883,7 +885,7 @@ schedule_ue_spec(
                                        ENB_FLAG_YES,
                                        MBMS_FLAG_NO,
                                        DCCH+1,
-                                       (char *)&dlsch_buffer[sdu_lengths[0]]);
+                                       (char *)&dlsch_buffer[sdu_lengths[num_sdus]]);
 
             T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP),
               T_INT(harq_pid), T_INT(DCCH+1), T_INT(sdu_lengths[num_sdus]));
@@ -893,80 +895,96 @@ schedule_ue_spec(
             header_len_dcch += 2;
             UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH1]+=1;
             UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH1]+=sdu_lengths[num_sdus];
-            num_sdus++;
-            LOG_D(MAC,"[eNB %d] CC_id %d Got %d bytes for DCCH from RLC\n",module_idP,CC_id,sdu_lengths[0]);
-          }
-        }
-
-        // check for DTCH and update header information
-        // here we should loop over all possible DTCH
-
-        header_len_dtch = 3; // 3 bytes DTCH SDU subheader
-
-        LOG_D(MAC,"[eNB %d], Frame %d, DTCH->DLSCH, CC_id %d, Checking RLC status (rab %d, tbs %d, len %d)\n",
-              module_idP,frameP,CC_id,DTCH,TBS,
-              TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch);
-
-        if (TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) {
-          rlc_status = mac_rlc_status_ind(
-                         module_idP,
-                         rnti,
-			 module_idP,
-                         frameP,
-                         ENB_FLAG_YES,
-                         MBMS_FLAG_NO,
-                         DTCH,
-                         TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch);
-
-          if (rlc_status.bytes_in_buffer > 0) {
-
-            LOG_D(MAC,"[eNB %d][USER-PLANE DEFAULT DRB], Frame %d, DTCH->DLSCH, CC_id %d, Requesting %d bytes from RLC (hdr len dtch %d)\n",
-                  module_idP,frameP,CC_id,TBS-header_len_dcch-sdu_length_total-header_len_dtch,header_len_dtch);
-            sdu_lengths[num_sdus] = mac_rlc_data_req(
-                                      module_idP,
-                                      rnti,
-				      module_idP,
-                                      frameP,
-                                      ENB_FLAG_YES,
-                                      MBMS_FLAG_NO,
-                                      DTCH,
-                                      (char*)&dlsch_buffer[sdu_length_total]);
-
-            T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP),
-              T_INT(harq_pid), T_INT(DTCH), T_INT(sdu_lengths[num_sdus]));
-
-            LOG_D(MAC,"[eNB %d][USER-PLANE DEFAULT DRB] CC_id %d Got %d bytes for DTCH %d \n",
-                  module_idP,CC_id,sdu_lengths[num_sdus],DTCH);
-            sdu_lcids[num_sdus] = DTCH;
-            sdu_length_total += sdu_lengths[num_sdus];
-            UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DTCH]+=1;
-            UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DTCH]+=sdu_lengths[num_sdus];
+	    num_sdus++;
+#ifdef DEBUG_eNB_SCHEDULER
+            LOG_T(MAC,"[eNB %d][DCCH1] CC_id %d Got %d bytes :",module_idP,CC_id,sdu_lengths[num_sdus]);
 
-            if (sdu_lengths[num_sdus] < 128) {
-              header_len_dtch=2;
+            for (j=0; j<sdu_lengths[num_sdus]; j++) {
+              LOG_T(MAC,"%x ",dlsch_buffer[j]);
             }
 
-            num_sdus++;
-          } else {
-            header_len_dtch = 0;
-          }
-        }
-
-        // there is a payload
-        if (((sdu_length_total + header_len_dcch + header_len_dtch )> 0)) {
-
-          // Now compute number of required RBs for total sdu length
-          // Assume RAH format 2
-          // adjust  header lengths
-          header_len_dcch_tmp = header_len_dcch;
-          header_len_dtch_tmp = header_len_dtch;
+            LOG_T(MAC,"\n");
+#endif
 
-          if (header_len_dtch==0) {
-            header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch;  // remove length field
-          } else {
-            header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch;     // remove length field for the last SDU
-          }
+	  }
+        }
 
+	// assume the max dtch header size, and adjust it later
+	header_len_dtch=0;
+	header_len_dtch_last=0; // the header length of the last mac sdu
+	// lcid has to be sorted before the actual allocation (similar struct as ue_list).
+	for (lcid=NB_RB_MAX-1; lcid>=DTCH ; lcid--){
+	  // TBD: check if the lcid is active
+	  
+	  header_len_dtch+=3; 
+	  header_len_dtch_last=3;
+	  LOG_D(MAC,"[eNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (tbs %d, len %d)\n",
+		module_idP,frameP,lcid,TBS,
+		TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch);
+	  
+	  if (TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { // NN: > 2 ? 
+	    rlc_status = mac_rlc_status_ind(module_idP,
+					    rnti,
+					    module_idP,
+					    frameP,
+					    ENB_FLAG_YES,
+					    MBMS_FLAG_NO,
+					    lcid,
+					    TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch);
+	   
+
+	    if (rlc_status.bytes_in_buffer > 0) {
+	      
+	      LOG_D(MAC,"[eNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting %d bytes from RLC (lcid %d total hdr len %d)\n",
+		    module_idP,frameP,TBS-header_len_dcch-sdu_length_total-header_len_dtch,lcid, header_len_dtch);
+	      sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
+						       rnti,
+						       module_idP,
+						       frameP,
+						       ENB_FLAG_YES,
+						       MBMS_FLAG_NO,
+						       lcid,
+						       (char*)&dlsch_buffer[sdu_length_total]);
+	      T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP),
+              T_INT(harq_pid), T_INT(lcid), T_INT(sdu_lengths[num_sdus]));
+
+	      LOG_D(MAC,"[eNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n",module_idP,sdu_lengths[num_sdus],lcid);
+	      sdu_lcids[num_sdus] = lcid;
+	      sdu_length_total += sdu_lengths[num_sdus];
+	      UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid]+=1;
+	      UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid]+=sdu_lengths[num_sdus];
+	      if (sdu_lengths[num_sdus] < 128) {
+		header_len_dtch--;
+		header_len_dtch_last--;
+	      }
+	      num_sdus++;
+	    } // no data for this LCID
+	    else {
+	      header_len_dtch-=3;
+	    }
+	  } // no TBS left
+	  else {
+	    header_len_dtch-=3;
+	    break; 
+	  }
+	}
+	if (header_len_dtch == 0 )
+	  header_len_dtch_last= 0;
+	// there is at least one SDU 
+	// if (num_sdus > 0 ){
+	if ((sdu_length_total + header_len_dcch + header_len_dtch )> 0) {
+	  
+	  // Now compute number of required RBs for total sdu length
+	  // Assume RAH format 2
+	  // adjust  header lengths
+	  header_len_dcch_tmp = header_len_dcch;
+	  header_len_dtch_tmp = header_len_dtch;
+	  if (header_len_dtch==0) {
+	    header_len_dcch = (header_len_dcch >0) ? 1 : 0;//header_len_dcch;  // remove length field
+	  } else {
+	    header_len_dtch_last-=1; // now use it to find how many bytes has to be removed for the last MAC SDU 
+	    header_len_dtch = (header_len_dtch > 0) ? header_len_dtch - header_len_dtch_last  :header_len_dtch;     // remove length field for the last SDU
+	  }
 
           mcs = eNB_UE_stats->dlsch_mcs1;
 
@@ -1080,8 +1098,7 @@ schedule_ue_spec(
                   "[eNB %d][DLSCH] Frame %d Generate header for UE_id %d on CC_id %d: sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,timing advance value : %d, padding %d,post_padding %d,(mcs %d, TBS %d, nb_rb %d),header_dcch %d, header_dtch %d\n",
                   module_idP,frameP, UE_id, CC_id, sdu_length_total,num_sdus,sdu_lengths[0],sdu_lcids[0],offset,
                   ue_sched_ctl->ta_update,padding,post_padding,mcs,TBS,nb_rb,header_len_dcch,header_len_dtch);
-          }
-
+	  }
           //#endif
 #ifdef DEBUG_eNB_SCHEDULER
           LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n");
@@ -1110,6 +1127,9 @@ schedule_ue_spec(
                   module_idP, CC_id, frameP, UE_RNTI(module_idP,UE_id), TBS);
           }
 
+          T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP),
+            T_INT(harq_pid), T_BUFFER(UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], TBS));
+
           aggregation = process_ue_cqi(module_idP,UE_id);
           UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb;
 
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index bb9e7b3d306512aa8d38eb6d88f442c529c9ee86..54eedb49266b4348b5aa67baff1c2cd3e44f24f6 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -75,7 +75,7 @@ void init_ue_sched_info(void)
   module_id_t i,j,k;
 
   for (i=0; i<NUMBER_OF_eNB_MAX; i++) {
-    for (k=0; i<MAX_NUM_CCs; i++) {
+    for (k=0; k<MAX_NUM_CCs; k++) {
       for (j=0; j<NUMBER_OF_UE_MAX; j++) {
         // init DL
         eNB_dlsch_info[i][k][j].weight           = 0;
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index fe37d298f7954fc7fa130eb0e6822dd4fb4e969f..05631e5b6e7279f53b0473cdcd1f33d22b311ebe 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -71,16 +71,15 @@
 // This table holds the allowable PRB sizes for ULSCH transmissions
 uint8_t rb_table[33] = {1,2,3,4,5,6,8,9,10,12,15,16,18,20,24,25,27,30,32,36,40,45,48,50,54,60,72,75,80,81,90,96,100};
 
-void rx_sdu(
-  const module_id_t enb_mod_idP,
-  const int         CC_idP,
-  const frame_t     frameP,
-  const sub_frame_t subframeP,
-  const rnti_t      rntiP,
-  uint8_t          *sduP,
-  const uint16_t    sdu_lenP,
-  const int         harq_pidP,
-  uint8_t          *msg3_flagP)
+void rx_sdu(const module_id_t enb_mod_idP,
+	    const int         CC_idP,
+	    const frame_t     frameP,
+	    const sub_frame_t subframeP,
+	    const rnti_t      rntiP,
+	    uint8_t          *sduP,
+	    const uint16_t    sdu_lenP,
+	    const int         harq_pidP,
+	    uint8_t          *msg3_flagP)
 {
 
   unsigned char  rx_ces[MAX_NUM_CE],num_ce,num_sdu,i,*payload_ptr;
@@ -325,7 +324,6 @@ void rx_sdu(
               enb_mod_idP, CC_idP, frameP, rx_lengths[i], CCCH_PAYLOAD_SIZE_MAX);
         break;
       }
-
       LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, Received CCCH:  %x.%x.%x.%x.%x.%x, Terminating RA procedure for UE rnti %x\n",
             enb_mod_idP,CC_idP,frameP,
             payload_ptr[0],payload_ptr[1],payload_ptr[2],payload_ptr[3],payload_ptr[4], payload_ptr[5], rntiP);
@@ -382,21 +380,19 @@ void rx_sdu(
 
         } // if process is active
       } // loop on RA processes
+      
+      break ;
 
-      break;
-
-    case  DCCH :
+    case DCCH :
     case DCCH1 :
       //      if(eNB_mac_inst[module_idP][CC_idP].Dcch_lchan[UE_id].Active==1){
       
 
 #if defined(ENABLE_MAC_PAYLOAD_DEBUG)
       LOG_T(MAC,"offset: %d\n",(unsigned char)((unsigned char*)payload_ptr-sduP));
-      
       for (j=0; j<32; j++) {
         LOG_T(MAC,"%x ",payload_ptr[j]);
       }
-
       LOG_T(MAC,"\n");
 #endif
 
@@ -425,67 +421,69 @@ void rx_sdu(
           UE_list->eNB_UE_stats[CC_idP][UE_id].num_pdu_rx[rx_lcids[i]]+=1;
           UE_list->eNB_UE_stats[CC_idP][UE_id].num_bytes_rx[rx_lcids[i]]+=rx_lengths[i];
       } /* UE_id != -1 */
-
-      //      }
+ 
+      // } 
       break;
 
-    case DTCH: // default DRB
-      //      if(eNB_mac_inst[module_idP][CC_idP].Dcch_lchan[UE_id].Active==1){
+      // all the DRBS
+    case DTCH:
+    default :
 
 #if defined(ENABLE_MAC_PAYLOAD_DEBUG)
       LOG_T(MAC,"offset: %d\n",(unsigned char)((unsigned char*)payload_ptr-sduP));
-
       for (j=0; j<32; j++) {
         LOG_T(MAC,"%x ",payload_ptr[j]);
       }
-
       LOG_T(MAC,"\n");
 #endif
+      if (rx_lcids[i]  < NB_RB_MAX ) {
+	LOG_D(MAC,"[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d\n",
+	      enb_mod_idP,CC_idP,frameP, rx_lengths[i], UE_id, rx_lcids[i]);
+	
+	if (UE_id != -1) {
+	  // adjust buffer occupancy of the correponding logical channel group
+	  LOG_D(MAC,"[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d, removing from LCGID %d, %d\n",
+		enb_mod_idP,CC_idP,frameP, rx_lengths[i], UE_id,rx_lcids[i],
+		UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]],
+		UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]]);
+	  
+	  if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] >= rx_lengths[i])
+	    UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] -= rx_lengths[i];
+	  else
+	    UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] = 0;
+	  if ((rx_lengths[i] <SCH_PAYLOAD_SIZE_MAX) &&  (rx_lengths[i] > 0) ) {   // MAX SIZE OF transport block
+	    mac_rlc_data_ind(
+			     enb_mod_idP,
+			     rntiP,
+			     enb_mod_idP,
+			     frameP,
+			     ENB_FLAG_YES,
+			     MBMS_FLAG_NO,
+			     rx_lcids[i],
+			     (char *)payload_ptr,
+			     rx_lengths[i],
+			     1,
+			     NULL);//(unsigned int*)crc_status);
+	    
+	    UE_list->eNB_UE_stats[CC_idP][UE_id].num_pdu_rx[rx_lcids[i]]+=1;
+	    UE_list->eNB_UE_stats[CC_idP][UE_id].num_bytes_rx[rx_lcids[i]]+=rx_lengths[i];
+	  }
+	  else { /* rx_length[i] */
+	    UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx+=1;
+	    LOG_E(MAC,"[eNB %d] CC_id %d Frame %d : Max size of transport block reached LCID %d from UE %d ",
+		  enb_mod_idP, CC_idP, frameP, rx_lcids[i], UE_id);
+	  }
+	}    
+	else {/*(UE_id != -1*/ 
+	  UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx+=1;
+	  LOG_E(MAC,"[eNB %d] CC_id %d Frame %d : received unsupported or unknown LCID %d from UE %d ",
+		enb_mod_idP, CC_idP, frameP, rx_lcids[i], UE_id);
+	}
+      }
 
-      LOG_D(MAC,"[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d\n",
-            enb_mod_idP,CC_idP,frameP, rx_lengths[i], UE_id,rx_lcids[i]);
-
-      if (UE_id != -1) {
-	// adjust buffer occupancy of the correponding logical channel group
-	LOG_D(MAC,"[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d, removing from LCGID %d, %d\n",
-	      enb_mod_idP,CC_idP,frameP, rx_lengths[i], UE_id,rx_lcids[i],
-	      UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]],
-	      UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]]);
-
-	if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] >= rx_lengths[i])
-	  UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] -= rx_lengths[i];
-	else
-	  UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] = 0;
-
-        if ((rx_lengths[i] <SCH_PAYLOAD_SIZE_MAX) &&  (rx_lengths[i] > 0) ) {   // MAX SIZE OF transport block
-          mac_rlc_data_ind(
-            enb_mod_idP,
-            rntiP,
-            enb_mod_idP,
-            frameP,
-            ENB_FLAG_YES,
-            MBMS_FLAG_NO,
-            DTCH,
-            (char *)payload_ptr,
-            rx_lengths[i],
-            1,
-            NULL);//(unsigned int*)crc_status);
-          UE_list->eNB_UE_stats[CC_idP][UE_id].num_pdu_rx[rx_lcids[i]]+=1;
-          UE_list->eNB_UE_stats[CC_idP][UE_id].num_bytes_rx[rx_lcids[i]]+=rx_lengths[i];
-        }
-      } /* UE_id != -1 */
-
-      //      }
-      break;
-
-    default :  //if (rx_lcids[i] >= DTCH) {
-      if (UE_id != -1)
-        UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx+=1;
-      LOG_E(MAC,"[eNB %d] CC_id %d Frame %d : received unsupported or unknown LCID %d from UE %d ",
-            enb_mod_idP, CC_idP, frameP, rx_lcids[i], UE_id);
       break;
     }
-
+  
     payload_ptr+=rx_lengths[i];
   }
 
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index ee6340cb43a4b7dfb6483725b3e57cffeba8d328..90d227eb35a500f27d913845239727c05d565605 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -302,16 +302,12 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i
 
 //------------------------------------------------------------------------------
 void
-ue_send_sdu(
-  module_id_t module_idP,
-  uint8_t CC_id,
-  frame_t frameP,
-  uint8_t* sdu,
-  uint16_t sdu_len,
-  uint8_t eNB_index
-)
-//------------------------------------------------------------------------------
-{
+ue_send_sdu(module_id_t module_idP,
+	    uint8_t CC_id,
+	    frame_t frameP,
+	    uint8_t* sdu,
+	    uint16_t sdu_len,
+	    uint8_t eNB_index) {
 
   unsigned char rx_ces[MAX_NUM_CE],num_ce,num_sdu,i,*payload_ptr;
   unsigned char rx_lcids[NB_RB_MAX];
@@ -401,7 +397,7 @@ ue_send_sdu(
 #ifdef DEBUG_HEADER_PARSING
     LOG_D(MAC,"[UE] SDU %d : LCID %d, length %d\n",i,rx_lcids[i],rx_lengths[i]);
 #endif
-
+    
     if (rx_lcids[i] == CCCH) {
 
       LOG_D(MAC,"[UE %d] rnti %x Frame %d : DLSCH -> DL-CCCH, RRC message (eNB %d, %d bytes)\n",
@@ -431,7 +427,7 @@ ue_send_sdu(
                        eNB_index,
                        0);
 
-    } else if (rx_lcids[i] == DCCH) {
+    } else if ((rx_lcids[i] == DCCH) || (rx_lcids[i] == DCCH1)) {
       LOG_D(MAC,"[UE %d] Frame %d : DLSCH -> DL-DCCH%d, RRC message (eNB %d, %d bytes)\n", module_idP, frameP, rx_lcids[i],eNB_index,rx_lengths[i]);
       mac_rlc_data_ind(module_idP,
                        UE_mac_inst[module_idP].crnti,
@@ -439,53 +435,39 @@ ue_send_sdu(
                        frameP,
                        ENB_FLAG_NO,
                        MBMS_FLAG_NO,
-                       DCCH,
-                       (char *)payload_ptr,
-                       rx_lengths[i],
-                       1,
-                       NULL);
-    } else if (rx_lcids[i] == DCCH1) {
-      LOG_D(MAC,"[UE %d] Frame %d : DLSCH -> DL-DCCH%d, RRC message (eNB %d, %d bytes)\n", module_idP, frameP, rx_lcids[i], eNB_index,rx_lengths[i]);
-      mac_rlc_data_ind(module_idP,
-                       UE_mac_inst[module_idP].crnti,
-		       eNB_index,
-		       frameP,
-                       ENB_FLAG_NO,
-                       MBMS_FLAG_NO,
-                       DCCH1,
+                       rx_lcids[i],
                        (char *)payload_ptr,
                        rx_lengths[i],
                        1,
                        NULL);
-    } else if (rx_lcids[i] == DTCH) {
+ 
+    } else if ((rx_lcids[i]  < NB_RB_MAX) && (rx_lcids[i] > DCCH1 )) {
+      
       LOG_D(MAC,"[UE %d] Frame %d : DLSCH -> DL-DTCH%d (eNB %d, %d bytes)\n", module_idP, frameP,rx_lcids[i], eNB_index,rx_lengths[i]);
 
 #if defined(ENABLE_MAC_PAYLOAD_DEBUG)
       int j;
-
-      for (j=0; j<rx_lengths[i]; j++) {
-        LOG_T(MAC,"%x.",(unsigned char)payload_ptr[j]);
-      }
-
+      for (j=0;j<rx_lengths[i];j++)
+	LOG_T(MAC,"%x.",(unsigned char)payload_ptr[j]);
       LOG_T(MAC,"\n");
 #endif
-
       mac_rlc_data_ind(module_idP,
-                       UE_mac_inst[module_idP].crnti,
+		       UE_mac_inst[module_idP].crnti,
 		       eNB_index,
 		       frameP,
-                       ENB_FLAG_NO,
-                       MBMS_FLAG_NO,
-                       DTCH,
-                       (char *)payload_ptr,
-                       rx_lengths[i],
-                       1,
-                       NULL);
+		       ENB_FLAG_NO,
+		       MBMS_FLAG_NO,
+		       rx_lcids[i],
+		       (char *)payload_ptr,
+		       rx_lengths[i],
+		       1,
+		       NULL);
+    } else {
+      LOG_E(MAC,"[UE %d] Frame %d : unknown LCID %d (eNB %d)\n", module_idP, frameP,rx_lcids[i], eNB_index);
     }
-
     payload_ptr+= rx_lengths[i];
   }
-
+  
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_OUT);
   stop_meas(&UE_mac_inst[module_idP].rx_dlsch_sdu);
 }
@@ -1196,10 +1178,11 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
 {
 
   mac_rlc_status_resp_t rlc_status;
-  uint8_t dcch_header_len=0,dcch1_header_len=0,dtch_header_len=0;
+  uint8_t dcch_header_len=0,dcch1_header_len=0,dtch_header_len=0,dtch_header_len_last=0;
   uint8_t dcch_header_len_tmp=0, dtch_header_len_tmp=0;
   uint8_t bsr_header_len=0, bsr_ce_len=0, bsr_len=0;
   uint8_t phr_header_len=0, phr_ce_len=0,phr_len=0;
+  uint8_t lcid=0;
   uint16_t sdu_lengths[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
   uint8_t sdu_lcids[8]    = { 0, 0, 0, 0, 0, 0, 0, 0 };
   uint8_t payload_offset=0,num_sdus=0;
@@ -1277,18 +1260,27 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
   // check for UL bandwidth requests and add SR control element
 
   // Check for DCCH first
-  sdu_lengths[0]=0;
 
   if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] == LCID_NOT_EMPTY) {
 
-    rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti, eNB_index, frameP,ENB_FLAG_NO,MBMS_FLAG_NO, // eNB_index
+    rlc_status = mac_rlc_status_ind(module_idP, 
+				    UE_mac_inst[module_idP].crnti, 
+				    eNB_index, 
+				    frameP,
+				    ENB_FLAG_NO,
+				    MBMS_FLAG_NO, // eNB_index
                                     DCCH,
                                     (buflen-dcch_header_len-bsr_len-phr_len));
     LOG_D(MAC, "[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to "
           "send (Transport Block size %d, mac header len %d)\n",
           module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dcch_header_len);
 
-    sdu_lengths[0] += mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti,eNB_index,frameP,ENB_FLAG_NO, MBMS_FLAG_NO,
+    sdu_lengths[0] += mac_rlc_data_req(module_idP, 
+				       UE_mac_inst[module_idP].crnti,
+				       eNB_index,
+				       frameP,
+				       ENB_FLAG_NO, 
+				       MBMS_FLAG_NO,
                                        DCCH,
                                        (char *)&ulsch_buff[sdu_lengths[0]]);
 
@@ -1306,11 +1298,15 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
   // if the RLC AM is used, then RLC will only provide 2 bytes for ACK
   // in this case, we sould add bsr
 
-
   // DCCH1
   if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] == LCID_NOT_EMPTY) {
 
-    rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti, eNB_index,frameP,ENB_FLAG_NO,MBMS_FLAG_NO, // eNB_index
+    rlc_status = mac_rlc_status_ind(module_idP, 
+				    UE_mac_inst[module_idP].crnti, 
+				    eNB_index,
+				    frameP,
+				    ENB_FLAG_NO,
+				    MBMS_FLAG_NO, // eNB_index
                                     DCCH1,
                                     (buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-sdu_length_total));
 
@@ -1318,9 +1314,14 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
           " send (Transport Block size %d, mac header len %d)\n",
           module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dcch1_header_len);
 
-    sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti,eNB_index,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
-                            DCCH1,
-                            (char *)&ulsch_buff[sdu_lengths[0]]);
+    sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 
+					     UE_mac_inst[module_idP].crnti,
+					     eNB_index,
+					     frameP,
+					     ENB_FLAG_NO,
+					     MBMS_FLAG_NO,
+					     DCCH1,
+					     (char *)&ulsch_buff[sdu_lengths[num_sdus]]);
     sdu_length_total += sdu_lengths[num_sdus];
     sdu_lcids[num_sdus] = DCCH1;
     LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH1\n",module_idP,sdu_lengths[num_sdus]);
@@ -1331,8 +1332,14 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
     dcch1_header_len =0;
   }
 
-  if ((UE_mac_inst[module_idP].scheduling_info.LCID_status[DTCH] == LCID_NOT_EMPTY) &&
-      ((bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len+sdu_length_total) <= buflen)) {
+  dtch_header_len=0;
+  dtch_header_len_last=0;
+  for (lcid=NB_RB_MAX-1; lcid>=DTCH ; lcid--){
+    dtch_header_len+=3; 
+    dtch_header_len_last=3;
+    
+    if ((UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) &&
+	((bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len+sdu_length_total) <= buflen)) {
 
     // optimize the dtch header lenght
     //if ((UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH] > 128) &&
@@ -1343,29 +1350,47 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
     else
     dtch_header_len = 2;//sizeof(SCH_SUBHEADER_SHORT);
      */
-    rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti, eNB_index,frameP,ENB_FLAG_NO,MBMS_FLAG_NO, // eNB_index
-                                    DTCH,
-                                    buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total);
-
-    LOG_D(MAC,"[UE %d] Frame %d : UL-DTCH -> ULSCH, %d bytes to send (Transport Block size %d, mac header len %d, BSR byte[DTCH] %d)\n",
-          module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dtch_header_len,
-          UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH]);
-
-    sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,UE_mac_inst[module_idP].crnti,eNB_index,frameP, ENB_FLAG_NO, MBMS_FLAG_NO, // eNB_index
-                            DTCH,
-                            (char *)&ulsch_buff[sdu_length_total]);
-
-    //adjust dtch header
-    dtch_header_len = (sdu_lengths[num_sdus] >= 128) ? 3 : 2;
-    LOG_D(MAC,"[UE %d] TX Got %d bytes for DTCH\n",module_idP,sdu_lengths[num_sdus]);
-    sdu_lcids[num_sdus] = DTCH;
-    sdu_length_total += sdu_lengths[num_sdus];
-    num_sdus++;
-    UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,DTCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DTCH]);
-  } else { // no rlc pdu : generate the dummy header
-    dtch_header_len = 0;
+      rlc_status = mac_rlc_status_ind(module_idP, 
+				      UE_mac_inst[module_idP].crnti, 
+				      eNB_index,
+				      frameP,
+				      ENB_FLAG_NO,
+				      MBMS_FLAG_NO, // eNB_index
+				      lcid,
+				      buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total);
+
+      LOG_D(MAC,"[UE %d] Frame %d : UL-DTCH -> ULSCH%d, %d bytes to send (Transport Block size %d, mac header len %d, BSR byte[%d] %d)\n",
+	    module_idP,frameP, lcid, rlc_status.bytes_in_buffer,buflen,dtch_header_len,
+	    lcid, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcid]);
+      
+       if (rlc_status.bytes_in_buffer > 0) {
+	 sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
+						  UE_mac_inst[module_idP].crnti,
+						  eNB_index,
+						  frameP, 
+						  ENB_FLAG_NO, 
+						  MBMS_FLAG_NO, // eNB_index
+						  lcid,
+						  (char *)&ulsch_buff[sdu_length_total]);
+	 
+	 //adjust dtch header
+	 LOG_D(MAC,"[UE %d] TX Got %d bytes for DTCH\n",module_idP,sdu_lengths[num_sdus]);
+	 sdu_lcids[num_sdus] = lcid;
+	 sdu_length_total += sdu_lengths[num_sdus];
+	 if (sdu_lengths[num_sdus] < 128) {
+	   dtch_header_len --;
+	   dtch_header_len_last --;
+	 }
+	 num_sdus++;
+	 UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]);
+       } else {
+	 dtch_header_len -= 3;
+       }
+    } else { // no rlc pdu : generate the dummy header
+      dtch_header_len -= 3;
+    }
   }
-
+  
   lcgid= get_bsr_lcgid(module_idP);
 
   if (lcgid < 0 ) {
@@ -1406,6 +1431,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
 
   LOG_T(MAC,"[UE %d] Frame %d: bsr s %p bsr_l %p, phr_p %p\n",  module_idP,frameP,bsr_s, bsr_l, phr_p);
 
+  if (dtch_header_len == 0 )
+    dtch_header_len_last =0;
+
   // adjust the header length
   dcch_header_len_tmp = dcch_header_len;
   dtch_header_len_tmp = dtch_header_len;
@@ -1413,7 +1441,8 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
   if (dtch_header_len==0) {
     dcch_header_len = (dcch_header_len>0)? 1: dcch_header_len;
   } else {
-    dtch_header_len= (dtch_header_len >0)? 1: dtch_header_len;   // for short and long, cut the length+F fields
+    dtch_header_len_last-=1; 
+    dtch_header_len= (dtch_header_len >0)? dtch_header_len - dtch_header_len_last : dtch_header_len;   
   }
 
   if ((buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total) <= 2) {
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
index d8fa42a19cc3f8a82e5d88fc3d531515287271d9..3779adbbc99adbd6a142f35f0635e4bfd29259de 100755
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
@@ -29,8 +29,9 @@
 
 /*! \file pdcp.c
  * \brief pdcp interface with RLC
- * \author  Lionel GAUTHIER and Navid Nikaein
+ * \author Navid Nikaein and Lionel GAUTHIER
  * \date 2009-2012
+ * \email navid.nikaein@eurecom.fr
  * \version 1.0
  */
 
@@ -83,7 +84,7 @@ extern int otg_enabled;
  * code at targets/TEST/PDCP/test_pdcp.c:test_pdcp_data_req()
  */
 boolean_t pdcp_data_req(
-  const protocol_ctxt_t* const  ctxt_pP,
+  protocol_ctxt_t*  ctxt_pP,
   const srb_flag_t     srb_flagP,
   const rb_id_t        rb_idP,
   const mui_t          muiP,
@@ -105,7 +106,6 @@ boolean_t pdcp_data_req(
   rlc_op_status_t    rlc_status;
   boolean_t          ret             = TRUE;
 
-
   hash_key_t         key             = HASHTABLE_NOT_A_KEY_VALUE;
   hashtable_rc_t     h_rc;
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_IN);
@@ -116,28 +116,6 @@ boolean_t pdcp_data_req(
     T(T_ENB_PDCP_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_buffer_sizeP));
 #endif
 
-  if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) {
-    AssertError (rb_idP < NB_RB_MBMS_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MBMS_MAX, ctxt_pP->module_id, ctxt_pP->rnti);
-  } else {
-    if (srb_flagP) {
-      AssertError (rb_idP < 2, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, 2, ctxt_pP->module_id, ctxt_pP->rnti);
-    } else {
-      AssertError (rb_idP < maxDRB, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, maxDRB, ctxt_pP->module_id, ctxt_pP->rnti);
-    }
-  }
-
-  key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
-  h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p);
-
-  if (h_rc != HASH_TABLE_OK) {
-    if (modeP != PDCP_TRANSMISSION_MODE_TRANSPARENT) {
-      LOG_W(PDCP, PROTOCOL_CTXT_FMT" Instance is not configured for rb_id %d Ignoring SDU...\n",
-            PROTOCOL_CTXT_ARGS(ctxt_pP),
-            rb_idP);
-    return FALSE;
-  }
-  }
-
   if (sdu_buffer_sizeP == 0) {
     LOG_W(PDCP, "Handed SDU is of size 0! Ignoring...\n");
     return FALSE;
@@ -153,14 +131,39 @@ boolean_t pdcp_data_req(
     // XXX What does following call do?
     mac_xface->macphy_exit("PDCP sdu buffer size > MAX_IP_PACKET_SIZE");
   }
+  
+  if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) {
+    AssertError (rb_idP < NB_RB_MBMS_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MBMS_MAX, ctxt_pP->module_id, ctxt_pP->rnti);
+  } else {
+    if (srb_flagP) {
+      AssertError (rb_idP < 3, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, 3, ctxt_pP->module_id, ctxt_pP->rnti);
+    } else {
+      AssertError (rb_idP < maxDRB, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, maxDRB, ctxt_pP->module_id, ctxt_pP->rnti);
+    }
+  }
 
+  key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
+  h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p);
+
+  if (h_rc != HASH_TABLE_OK) {
+    if (modeP != PDCP_TRANSMISSION_MODE_TRANSPARENT) {
+      LOG_W(PDCP, PROTOCOL_CTXT_FMT" Instance is not configured for rb_id %d Ignoring SDU...\n",
+	    PROTOCOL_CTXT_ARGS(ctxt_pP),
+	    rb_idP);
+      ctxt_pP->configured=FALSE;
+      return FALSE;
+    }
+  }else{
+    // instance for a given RB is configured
+    ctxt_pP->configured=TRUE;
+  }
+    
   if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
     start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
   } else {
     start_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
   }
 
-
   // PDCP transparent mode for MBMS traffic
 
   if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) {
@@ -916,7 +919,7 @@ pdcp_run (
           RRC_DCCH_DATA_REQ (msg_p).frame, 
 	  0,
 	  RRC_DCCH_DATA_REQ (msg_p).eNB_index);
-        LOG_D(PDCP, PROTOCOL_CTXT_FMT"Received %s from %s: instance %d, rb_id %d, muiP %d, confirmP %d, mode %d\n",
+        LOG_I(PDCP, PROTOCOL_CTXT_FMT"Received %s from %s: instance %d, rb_id %d, muiP %d, confirmP %d, mode %d\n",
               PROTOCOL_CTXT_ARGS(&ctxt),
               msg_name,
               ITTI_MSG_ORIGIN_NAME(msg_p),
@@ -1103,7 +1106,7 @@ rrc_pdcp_config_asn1_req (
       srb_id = srb2add_list_pP->list.array[cnt]->srb_Identity;
       srb_toaddmod_p = srb2add_list_pP->list.array[cnt];
       rlc_type = RLC_MODE_AM;
-      lc_id = srb_id + 2;
+      lc_id = srb_id;// + 2;
       key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_YES);
       h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p);
 
@@ -1439,13 +1442,14 @@ pdcp_config_req_asn1 (
     pdcp_pP->first_missing_pdu                = -1;
     pdcp_pP->rx_hfn_offset                    = 0;
 
-    LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" Action ADD  LCID %d (rb id %d) "
+    LOG_N(PDCP, PROTOCOL_PDCP_CTXT_FMT" Action ADD  LCID %d (%s id %d) "
             "configured with SN size %d bits and RLC %s\n",
           PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP),
           lc_idP,
+	  (srb_flagP == SRB_FLAG_YES) ? "SRB" : "DRB",
           rb_idP,
           pdcp_pP->seq_num_size,
-            (rlc_modeP == RLC_MODE_AM ) ? "AM" : (rlc_modeP == RLC_MODE_TM) ? "TM" : "UM");
+	  (rlc_modeP == RLC_MODE_AM ) ? "AM" : (rlc_modeP == RLC_MODE_TM) ? "TM" : "UM");
     /* Setup security */
     if (security_modeP != 0xff) {
       pdcp_config_set_security(
@@ -1487,8 +1491,8 @@ pdcp_config_req_asn1 (
       pdcp_pP->seq_num_size=5;
     }
 
-    LOG_D(PDCP,PROTOCOL_PDCP_CTXT_FMT" Action MODIFY LCID %d "
-            "RB id %d configured with SN size %d and RLC %s \n",
+    LOG_N(PDCP,PROTOCOL_PDCP_CTXT_FMT" Action MODIFY LCID %d "
+            "RB id %d reconfigured with SN size %d and RLC %s \n",
           PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP),
           lc_idP,
           rb_idP,
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
index 9e5b15f5a322667c1c755f2ffca6d2b47a1639fc..52322b1348510309a3f00d6b827f4001ec02cf93 100755
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
@@ -221,7 +221,7 @@ typedef struct pdcp_mbms_s {
 * @ingroup _pdcp
 */
 public_pdcp(boolean_t pdcp_data_req(
-              const protocol_ctxt_t* const  ctxt_pP,
+              protocol_ctxt_t*  ctxt_pP,
               const srb_flag_t srb_flagP,
               const rb_id_t rb_id,
               const mui_t muiP,
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
index ea304f93ae94f49efb1f1a4ef8aab0743176bf8c..390ad5a48d380bd1f01e5968fbe9f8c8d39655ea 100755
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
@@ -29,9 +29,10 @@
 
 /*! \file pdcp_fifo.c
  * \brief pdcp interface with linux IP interface, have a look at http://man7.org/linux/man-pages/man7/netlink.7.html for netlink
- * \author  Lionel GAUTHIER and Navid Nikaein
- * \date 2009
+ * \author  Navid Nikaein and Lionel GAUTHIER
+ * \date 2009 - 2016
  * \version 0.5
+ * \email navid.nikaein@eurecom.fr
  * \warning This component can be runned only in user-space
  * @ingroup pdcp
  */
@@ -484,7 +485,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
             ctxt.enb_flag      = ENB_FLAG_NO;
             ctxt.module_id     = pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local + oai_emulation.info.first_ue_local;
             ctxt.rnti          = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
-            rab_id    = pdcp_read_header_g.rb_id  % maxDRB;
+            rab_id    = pdcp_read_header_g.rb_id % maxDRB;
           }
 
           CHECK_CTXT_ARGS(&ctxt);
diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c
index eccea461abac6c1b31b61abf40a2017a77fe6999..9919cc0f70fc5a93898994242f4f297439a6ed39 100644
--- a/openair2/LAYER2/RLC/rlc_rrc.c
+++ b/openair2/LAYER2/RLC/rlc_rrc.c
@@ -234,7 +234,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t   * const ctxt_pP
       drb_id = drb_toaddmod_p->drb_Identity;
       lc_id  = drb_id + 2;
 
-      LOG_D(RLC, "Adding DRB %d, lc_id %d\n",drb_id,lc_id);
+      LOG_I(RLC, "Adding DRB %d, lc_id %d\n",drb_id,lc_id);
 
 
       if (drb_toaddmod_p->rlc_Config) {
diff --git a/openair2/RRC/LITE/L2_interface.c b/openair2/RRC/LITE/L2_interface.c
index d4ddd0e7abb66d82412eaa47369d9c2882b297a5..a737be167eae9d25894c0bf83de7df2473ccb4e7 100644
--- a/openair2/RRC/LITE/L2_interface.c
+++ b/openair2/RRC/LITE/L2_interface.c
@@ -597,14 +597,14 @@ rrc_data_ind(
   rb_id_t    DCCH_index = Srb_id;
 
   if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
-    LOG_N(RRC, "[UE %x] Frame %d: received a DCCH %d message on SRB %d with Size %d from eNB ???\n",
-          ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id-1,sdu_sizeP);
+    LOG_N(RRC, "[UE %x] Frame %d: received a DCCH %d message on SRB %d with Size %d from eNB %d\n",
+          ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id,sdu_sizeP,  ctxt_pP->eNB_index);
   } else {
     LOG_N(RRC, "[eNB %d] Frame %d: received a DCCH %d message on SRB %d with Size %d from UE %x\n",
           ctxt_pP->module_id,
           ctxt_pP->frame,
           DCCH_index,
-          Srb_id-1,
+          Srb_id,
           sdu_sizeP,
           ctxt_pP->rnti);
   }
@@ -656,7 +656,7 @@ void rrc_in_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index)
 #if defined(ENABLE_ITTI)
   {
     MessageDef *message_p;
-
+    //LOG_I(RRC,"sending a message to task_mac_ue\n");
     message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_IN_SYNC_IND);
     RRC_MAC_IN_SYNC_IND (message_p).frame = frameP;
     RRC_MAC_IN_SYNC_IND (message_p).enb_index = eNB_index;
diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
index ff0adf713b04e4dd8edeb4cd878b51bba89f4b75..13cfae80da90fbd9557abe278fcf1a9dcda37303 100644
--- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
@@ -1566,9 +1566,11 @@ do_RRCConnectionSetup(
   *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=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
@@ -1602,6 +1604,8 @@ do_RRCConnectionSetup(
   //     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;
@@ -1609,7 +1613,7 @@ do_RRCConnectionSetup(
   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,
@@ -1634,6 +1638,11 @@ do_RRCConnectionSetup(
   case 6:
     physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm6;
     break;
+
+  case 7:
+    physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode=     AntennaInfoDedicated__transmissionMode_tm7;
+    break;
+    */
   }
 
 
@@ -2015,7 +2024,7 @@ do_RRCConnectionReconfiguration(
                                    (void*)&dl_dcch_msg,
                                    buffer,
                                    RRC_BUF_SIZE);
-  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %l)!\n",
                enc_rval.failed_type->name, enc_rval.encoded);
 
 #ifdef XER_PRINT
diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0 b/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0
deleted file mode 100644
index 18dc516285b45214f9dd88598ce8ed08753a7588..0000000000000000000000000000000000000000
--- a/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0
+++ /dev/null
@@ -1,13 +0,0 @@
-Index: skeletons/per_opentype.c
-===================================================================
---- skeletons/per_opentype.c	(revision 1516)
-+++ skeletons/per_opentype.c	(working copy)
-@@ -277,7 +306,7 @@
- 	(void)constraints;
- 	(void)sptr;
- 
--	while(per_get_few_bits(pd, 24) >= 0);
-+	while(per_get_few_bits(pd, 1 /*24*/) >= 0);
- 
- 	rv.code = RC_OK;
- 	rv.consumed = pd->moved;
diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h
index 7a5211544038281c46cc4e80a3552e6ff519c6c0..e546b52f8ebeb43dd552ff0767f11be3ce9e8ff3 100644
--- a/openair2/RRC/LITE/defs.h
+++ b/openair2/RRC/LITE/defs.h
@@ -187,6 +187,9 @@ typedef enum HO_STATE_e {
 #define CBA_OFFSET        0xfff4
 // #define NUM_MAX_CBA_GROUP 4 // in the platform_constants
 
+/* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */
+#define RRC_TRANSACTION_IDENTIFIER_NUMBER  3
+
 typedef struct UE_RRC_INFO_s {
   UE_STATE_t State;
   uint8_t SIB1systemInfoValueTag;
@@ -220,19 +223,20 @@ typedef struct UE_S_TMSI_s {
 #if defined(ENABLE_ITTI)
 typedef enum e_rab_satus_e {
   E_RAB_STATUS_NEW,
-  E_RAB_STATUS_DONE,
+  E_RAB_STATUS_DONE, // from the eNB perspective
+  E_RAB_STATUS_ESTABLISHED, // get the reconfigurationcomplete form UE
   E_RAB_STATUS_FAILED,
 } e_rab_status_t;
 
 typedef struct e_rab_param_s {
   e_rab_t param;
   uint8_t status;
+  uint8_t xid; // transaction_id
 } __attribute__ ((__packed__)) e_rab_param_t;
 #endif
 
 
 
-
 /* Intermediate structure for Handover management. Associated per-UE in eNB_RRC_INST */
 typedef struct HANDOVER_INFO_s {
   uint8_t ho_prepare;
@@ -282,7 +286,7 @@ typedef struct SRB_INFO_TABLE_ENTRY_s {
   SRB_INFO Srb_info;
   uint8_t Active;
   uint8_t Status;
-  uint32_t Next_check_frame;
+  uint32_t Next_check_frame; 
 } SRB_INFO_TABLE_ENTRY;
 
 typedef struct MEAS_REPORT_LIST_s {
@@ -302,7 +306,9 @@ typedef struct eNB_RRC_UE_s {
   SCellToAddMod_r10_t                sCell_config[2];
 #endif
   SRB_ToAddModList_t*                SRB_configList;
+  SRB_ToAddModList_t*                SRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
   DRB_ToAddModList_t*                DRB_configList;
+  DRB_ToAddModList_t*                DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
   uint8_t                            DRB_active[8];
   struct PhysicalConfigDedicated*    physicalConfigDedicated;
   struct SPS_Config*                 sps_Config;
@@ -347,10 +353,12 @@ typedef struct eNB_RRC_UE_s {
 
   security_capabilities_t            security_capabilities;
 
+  /* Total number of e_rab already setup in the list */
+  uint8_t                           setup_e_rabs;
   /* Number of e_rab to be setup in the list */
   uint8_t                            nb_of_e_rabs;
   /* list of e_rab to be setup by RRC layers */
-  e_rab_param_t                      e_rab[S1AP_MAX_E_RAB];
+  e_rab_param_t                      e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB];
 
   // LG: For GTPV1 TUNNELS
   uint32_t                           enb_gtp_teid[S1AP_MAX_E_RAB];
@@ -408,10 +416,10 @@ typedef struct {
 #endif
   SRB_INFO                          SI;
   SRB_INFO                          Srb0;
-} rcc_eNB_carrier_data_t;
+} rrc_eNB_carrier_data_t;
 
 typedef struct eNB_RRC_INST_s {
-  rcc_eNB_carrier_data_t          carrier[MAX_NUM_CCs];
+  rrc_eNB_carrier_data_t          carrier[MAX_NUM_CCs];
   uid_allocator_t                    uid_allocator; // for rrc_ue_head
   RB_HEAD(rrc_ue_tree_s, rrc_eNB_ue_context_s)     rrc_ue_head; // ue_context tree key search by rnti
   uint8_t                           HO_flag;
@@ -432,6 +440,11 @@ typedef struct eNB_RRC_INST_s {
   /// localization list for aggregated measurements from PHY
   struct list loc_list;
 #endif
+
+  //RRC configuration
+#if defined(ENABLE_ITTI)
+  RrcConfigurationReq configuration;
+#endif
 } eNB_RRC_INST;
 
 #define MAX_UE_CAPABILITY_SIZE 255
diff --git a/openair2/RRC/LITE/proto.h b/openair2/RRC/LITE/proto.h
index 7b316ce953459654a15288e976add44be44fc035..a7bc9c494072f8a8d23cdaf0515cfd167b3af8b5 100644
--- a/openair2/RRC/LITE/proto.h
+++ b/openair2/RRC/LITE/proto.h
@@ -228,19 +228,21 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject(
 void
 rrc_eNB_process_RRCConnectionSetupComplete(
   const protocol_ctxt_t* const ctxt_pP,
-  rrc_eNB_ue_context_t*          const ue_context_pP,
+  rrc_eNB_ue_context_t*        ue_context_pP,
   RRCConnectionSetupComplete_r8_IEs_t* rrcConnectionSetupComplete
 );
 
 /**\brief Process the RRCConnectionReconfigurationComplete based on information coming from UE
    \param ctxt_pP       Running context
    \param ue_context_pP RRC UE context
-   \param rrcConnectionReconfigurationComplete Pointer to RRCConnectionReconfigurationComplete message*/
+   \param rrcConnectionReconfigurationComplete Pointer to RRCConnectionReconfigurationComplete message
+   \param xid         the transaction id for the rrcconnectionreconfiguration procedure
+*/
 void
 rrc_eNB_process_RRCConnectionReconfigurationComplete(
   const protocol_ctxt_t* const ctxt_pP,
-  rrc_eNB_ue_context_t*          const ue_context_pP,
-  RRCConnectionReconfigurationComplete_r8_IEs_t* rrcConnectionReconfigurationComplete
+  rrc_eNB_ue_context_t*        ue_context_pP,
+  const uint8_t xid
 );
 
 /**\brief Generate the RRCConnectionRelease
@@ -259,6 +261,17 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
   const uint8_t                ho_state
 );
 
+void
+rrc_eNB_generate_dedeicatedRRCConnectionReconfiguration(
+  const protocol_ctxt_t* const ctxt_pP,
+  rrc_eNB_ue_context_t*          const ue_context_pP,
+  const uint8_t                ho_state
+);
+
+void 
+rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t* const ctxt_pP,
+			  rrc_eNB_ue_context_t*  ue_context_pP);
+
 #if defined(ENABLE_ITTI)
 /**\brief RRC eNB task.
    \param void *args_p Pointer on arguments to start the task. */
diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c
index d2dc56690cd0c259e821971945734bf4145844d4..f79e143d0376e88ddce3ea6b08aeea7b39238983 100644
--- a/openair2/RRC/LITE/rrc_eNB.c
+++ b/openair2/RRC/LITE/rrc_eNB.c
@@ -102,8 +102,7 @@
 #include "SIMULATION/TOOLS/defs.h" // for taus
 
 #include "enb_agent_extern.h"
-
-//#define XER_PRINT
+#define XER_PRINT
 
 #ifdef PHY_EMUL
 extern EMULATION_VARS              *Emul_vars;
@@ -116,9 +115,6 @@ extern void*                        bigphys_malloc(int);
 
 extern uint16_t                     two_tier_hexagonal_cellIds[7];
 
-/* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */
-static const uint8_t                RRC_TRANSACTION_IDENTIFIER_NUMBER = 4;
-
 mui_t                               rrc_eNB_mui = 0;
 
 //-----------------------------------------------------------------------------
@@ -508,6 +504,7 @@ rrc_eNB_get_next_transaction_identifier(
 {
   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];
 }
 /*------------------------------------------------------------------------------*/
@@ -856,15 +853,16 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
 void
 rrc_eNB_process_RRCConnectionSetupComplete(
   const protocol_ctxt_t* const ctxt_pP,
-  rrc_eNB_ue_context_t*          const ue_context_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\n",
+        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));
 
@@ -1153,13 +1151,293 @@ rrc_eNB_generate_RRCConnectionRelease(
 	       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_defaultRRCConnectionReconfiguration(
-  const protocol_ctxt_t* const ctxt_pP,
-  rrc_eNB_ue_context_t*          const ue_context_pP,
-  const uint8_t                ho_state
-)
+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++){
+    
+    // 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->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;
+      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 %d, DRB ID %d (index %d), QCI %d, priority %d, LCID %d LCGID %d \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
+#ifdef Rel10
+                                         , (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);
+
+
+}
+#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];
@@ -1167,8 +1445,8 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
   int                                 i;
 
   // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE
-  //eNB_RRC_INST*                       rrc_inst = &eNB_rrc_inst[ctxt_pP->module_id];
-  //struct PhysicalConfigDedicated**    physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated;
+  eNB_RRC_INST*                       rrc_inst = &eNB_rrc_inst[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;
@@ -1176,7 +1454,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
   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;
+  SRB_ToAddModList_t                 **SRB_configList2                  = NULL;
 
   struct DRB_ToAddMod                *DRB_config                       = NULL;
   struct RLC_Config                  *DRB_rlc_config                   = NULL;
@@ -1187,8 +1465,8 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
   struct LogicalChannelConfig__ul_SpecificParameters
       *DRB_ul_SpecificParameters        = NULL;
   DRB_ToAddModList_t**                DRB_configList = &ue_context_pP->ue_context.DRB_configList;
-
-  MAC_MainConfig_t                   *mac_MainConfig                   = NULL;
+  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;
@@ -1216,6 +1494,9 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
   (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;
@@ -1247,9 +1528,13 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
 
   // 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));
-  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));
@@ -1271,7 +1556,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
 
   SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters));
 
-  SRB2_ul_SpecificParameters->priority = 1;
+  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 =
@@ -1284,12 +1569,29 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
   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);
-  ASN_SEQUENCE_ADD(&SRB_configList2->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));
 
@@ -1297,7 +1599,6 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
   *(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
-  // 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
@@ -1350,9 +1651,9 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
   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->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;
 
@@ -1362,6 +1663,9 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
   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;
@@ -1398,6 +1702,80 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
   //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 %d+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");
+#ifdef Rel10
+	*((*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));
@@ -1651,7 +2029,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
     //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;
+    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;
@@ -1677,7 +2055,8 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
     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,
+      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);
     }
@@ -1691,6 +2070,8 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
 
     /* 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 */
@@ -1705,15 +2086,15 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
 
   size = do_RRCConnectionReconfiguration(ctxt_pP,
                                          buffer,
-                                         rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),   //Transaction_id,
-                                         (SRB_ToAddModList_t*)NULL, /// NN: do not reconfig srb1: SRB_configList2,
+                                         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,NULL,
+                                         NULL, NULL, NULL,NULL,
 #else
-                                         (struct PhysicalConfigDedicated*)*physicalConfigDedicated,
                                          (MeasObjectToAddModList_t*)MeasObj_list,
                                          (ReportConfigToAddModList_t*)ReportConfig_list,
                                          (QuantityConfig_t*)quantityConfig,
@@ -1733,11 +2114,9 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
 
 #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
@@ -2889,11 +3268,12 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover(
   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
+  // 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);
 
@@ -3051,8 +3431,8 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover(
 void
 rrc_eNB_process_RRCConnectionReconfigurationComplete(
   const protocol_ctxt_t* const ctxt_pP,
-  rrc_eNB_ue_context_t*          const ue_context_pP,
-  RRCConnectionReconfigurationComplete_r8_IEs_t* rrcConnectionReconfigurationComplete
+  rrc_eNB_ue_context_t*        ue_context_pP,
+  const uint8_t xid
 )
 //-----------------------------------------------------------------------------
 {
@@ -3071,8 +3451,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
   uint8_t                            *kRRCint = NULL;
   uint8_t                            *kUPenc = NULL;
 
-  DRB_ToAddModList_t*                 DRB_configList = ue_context_pP->ue_context.DRB_configList;
-  //SRB_ToAddModList_t*                 SRB_configList = ue_context_pP->ue_context.SRB_configList;
+  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];
 
   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));
@@ -3135,8 +3515,9 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
 
   rrc_pdcp_config_asn1_req(
     ctxt_pP,
-    NULL,  //LG-RK 14/05/2014 SRB_configList,
-    DRB_configList, (DRB_ToReleaseList_t *) NULL,
+    SRB_configList, //NULL,  //LG-RK 14/05/2014 SRB_configList,
+    DRB_configList, 
+    (DRB_ToReleaseList_t *) NULL,
     /*eNB_rrc_inst[ctxt_pP->module_id].ciphering_algorithm[ue_mod_idP] |
              (eNB_rrc_inst[ctxt_pP->module_id].integrity_algorithm[ue_mod_idP] << 4),
      */
@@ -3151,14 +3532,36 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
   // Refresh SRBs/DRBs
   rrc_rlc_config_asn1_req(
     ctxt_pP,
-    NULL,  //LG-RK 14/05/2014 SRB_configList,
+    SRB_configList, // NULL,  //LG-RK 14/05/2014 SRB_configList,
     DRB_configList,
     (DRB_ToReleaseList_t *) NULL
 #ifdef Rel10
     , (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 %d\n",
+	      ctxt_pP->module_id,
+	      ctxt_pP->frame,
+	      SRB_configList->list.array[i]->srb_Identity);
+      }
+    }
+  }
+  
   // Loop through DRBs and establish if necessary
 
   if (DRB_configList != NULL) {
@@ -3345,7 +3748,7 @@ rrc_eNB_generate_RRCConnectionSetup(
     do_RRCConnectionSetup(ctxt_pP,
                           ue_context_pP,
                           (uint8_t*) eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Payload,
-                          (mac_xface->lte_frame_parms->nb_antennas_tx==2)?2:1,
+			  (mac_xface->lte_frame_parms->nb_antennas_tx_eNB==2)?2:1, //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),
                           mac_xface->lte_frame_parms,
                           SRB_configList,
@@ -3504,6 +3907,7 @@ openair_rrc_eNB_init(
   eNB_rrc_inst[ctxt.module_id].initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL);
   eNB_rrc_inst[ctxt.module_id].s1ap_id2_s1ap_ids    = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL);
 
+  memcpy(&eNB_rrc_inst[ctxt.module_id].configuration,configuration,sizeof(RrcConfigurationReq));
 
   /// System Information INIT
 
@@ -3901,7 +4305,7 @@ rrc_eNB_decode_ccch(
              &DCCH_LCHAN_DESC,
              LCHAN_DESC_SIZE);
 
-      // SRB2
+      // 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],
@@ -3910,7 +4314,7 @@ rrc_eNB_decode_ccch(
       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),
@@ -3985,6 +4389,8 @@ rrc_eNB_decode_dcch(
   int i;
   struct rrc_eNB_ue_context_s*        ue_context_p = NULL;
 
+  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));
 
@@ -3992,8 +4398,11 @@ rrc_eNB_decode_dcch(
     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",
@@ -4108,17 +4517,24 @@ rrc_eNB_decode_dcch(
       if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.
           present ==
           RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) {
-        rrc_eNB_process_RRCConnectionReconfigurationComplete(
+	/*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 %d)\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 %d)\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.
-          criticalExtensions.choice.
-          rrcConnectionReconfigurationComplete_r8);
-        ue_context_p->ue_context.Status = RRC_RECONFIGURED;
-        LOG_I(RRC,
-              PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED \n",
-              PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+	  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 (mac_agent_registered[ctxt_pP->module_id]) {
 	  agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id,
@@ -4126,18 +4542,26 @@ rrc_eNB_decode_dcch(
 										PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED);
 	}
       }
-
-#if defined(ENABLE_USE_MME)
-#   if defined(ENABLE_ITTI)
-
+#if defined(ENABLE_ITTI)
+#   if defined(ENABLE_USE_MME)
       if (EPC_MODE_ENABLED == 1) {
-        rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(
-          ctxt_pP,
-          ue_context_p);
+	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);
+	}else {
+	  rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP,
+						       ue_context_p);
+	}
+      }    
+#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
+#endif 
       break;
 
     case UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete:
@@ -4365,7 +4789,14 @@ rrc_eNB_decode_dcch(
                                               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,
@@ -4475,6 +4906,40 @@ rrc_eNB_decode_dcch(
 }
 
 #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(
@@ -4570,7 +5035,12 @@ rrc_enb_task(
     case S1AP_PAGING_IND:
       LOG_E(RRC, "[eNB %d] Received not yet implemented message %s\n", instance, msg_name_p);
       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_UE_CONTEXT_RELEASE_REQ:
       rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance);
       break;
diff --git a/openair2/RRC/LITE/rrc_eNB_GTPV1U.c b/openair2/RRC/LITE/rrc_eNB_GTPV1U.c
index 29ff0d9dc2994f7ee83f4163deccf35233717323..89acbca195cd2e31b3b12fa50edd5b7e677e4b8b 100755
--- a/openair2/RRC/LITE/rrc_eNB_GTPV1U.c
+++ b/openair2/RRC/LITE/rrc_eNB_GTPV1U.c
@@ -68,14 +68,19 @@ rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
                      ctxt_pP->rnti);
 
     for (i = 0; i < create_tunnel_resp_pP->num_tunnels; i++) {
-      LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP tunnel %u bearer index %u id %u\n",
+      
+      ue_context_p->ue_context.enb_gtp_teid[i+ue_context_p->ue_context.setup_e_rabs]  = create_tunnel_resp_pP->enb_S1u_teid[i];
+      ue_context_p->ue_context.enb_gtp_addrs[i+ue_context_p->ue_context.setup_e_rabs] = create_tunnel_resp_pP->enb_addr;
+      ue_context_p->ue_context.enb_gtp_ebi[i+ue_context_p->ue_context.setup_e_rabs]   = create_tunnel_resp_pP->eps_bearer_id[i];
+      
+      LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP tunnel (%u, %u) bearer UE context index %u, msg index %u, id %u, gtp addr len %d \n",
             PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
             create_tunnel_resp_pP->enb_S1u_teid[i],
-            i,
-            create_tunnel_resp_pP->eps_bearer_id[i]);
-      ue_context_p->ue_context.enb_gtp_teid[i]  = create_tunnel_resp_pP->enb_S1u_teid[i];
-      ue_context_p->ue_context.enb_gtp_addrs[i] = create_tunnel_resp_pP->enb_addr;
-      ue_context_p->ue_context.enb_gtp_ebi[i]   = create_tunnel_resp_pP->eps_bearer_id[i];
+	    ue_context_p->ue_context.enb_gtp_teid[i+ue_context_p->ue_context.setup_e_rabs],
+            i+ue_context_p->ue_context.setup_e_rabs, 
+	    i,
+            create_tunnel_resp_pP->eps_bearer_id[i],
+	    create_tunnel_resp_pP->enb_addr.length);
     }
 	MSC_LOG_RX_MESSAGE(
 			  MSC_RRC_ENB,
diff --git a/openair2/RRC/LITE/rrc_eNB_S1AP.c b/openair2/RRC/LITE/rrc_eNB_S1AP.c
index 1414c4e1b305f116b2fe1121722010c4cb74e0f1..33d076b9f6a65ece81f975e574852ad840d7df74 100644
--- a/openair2/RRC/LITE/rrc_eNB_S1AP.c
+++ b/openair2/RRC/LITE/rrc_eNB_S1AP.c
@@ -1,6 +1,6 @@
 /*******************************************************************************
     OpenAirInterface
-    Copyright(c) 1999 - 2014 Eurecom
+    Copyright(c) 1999 - 2016 Eurecom
 
     OpenAirInterface is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -28,8 +28,8 @@
 *******************************************************************************/
 /*! \file rrc_eNB_S1AP.c
  * \brief rrc S1AP procedures for eNB
- * \author Laurent Winckel and Sebastien ROUX and Navid Nikaein and Lionel GAUTHIER
- * \date 2013-2014
+ * \author Navid Nikaein, Laurent Winckel, Sebastien ROUX, and Lionel GAUTHIER
+ * \date 2013-2016
  * \version 1.0
  * \company Eurecom
  * \email: navid.nikaein@eurecom.fr
@@ -60,6 +60,8 @@
 #endif
 #include "msc.h"
 
+#include "UERadioAccessCapabilityInformation.h"
+
 #include "gtpv1u_eNB_task.h"
 #include "RRC/LITE/rrc_eNB_GTPV1U.h"
 
@@ -479,8 +481,10 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(
       S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].gtp_teid = ue_context_pP->ue_context.enb_gtp_teid[e_rab];
       S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr = ue_context_pP->ue_context.enb_gtp_addrs[e_rab];
       S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr.length = 4;
+      ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED;
     } else {
       e_rabs_failed++;
+      ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED;
       S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs_failed[e_rab].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id;
       // TODO add cause when it will be integrated
     }
@@ -584,29 +588,42 @@ void rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(
 //------------------------------------------------------------------------------
 {
   UECapabilityInformation_t *ueCapabilityInformation = &ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation;
-
-  if ((ueCapabilityInformation->criticalExtensions.present == UECapabilityInformation__criticalExtensions_PR_c1)
-      && (ueCapabilityInformation->criticalExtensions.choice.c1.present
-          == UECapabilityInformation__criticalExtensions__c1_PR_ueCapabilityInformation_r8)
-      && (ueCapabilityInformation->criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.count > 0)) {
-    UE_CapabilityRAT_ContainerList_t* ue_CapabilityRAT_ContainerList =
-      &ueCapabilityInformation->criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList;
-    MessageDef *msg_p;
-
-    msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_UE_CAPABILITIES_IND);
-    S1AP_UE_CAPABILITIES_IND (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id;
-    S1AP_UE_CAPABILITIES_IND (msg_p).ue_radio_cap.length = ue_CapabilityRAT_ContainerList->list.array[0]->ueCapabilityRAT_Container.size;
-    S1AP_UE_CAPABILITIES_IND (msg_p).ue_radio_cap.buffer = ue_CapabilityRAT_ContainerList->list.array[0]->ueCapabilityRAT_Container.buf;
-
-    itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p);
-
-    if (ue_CapabilityRAT_ContainerList->list.count > 1) {
-      LOG_W (RRC,"[eNB %d][UE %x] can only handle 1 UE capability RAT item for now (%d)\n",
-             ctxt_pP->module_id,
-             ue_context_pP->ue_context.rnti,
-             ue_CapabilityRAT_ContainerList->list.count);
-    }
+  /* 4096 is arbitrary, should be big enough */
+  unsigned char buf[4096];
+  unsigned char *buf2;
+  UERadioAccessCapabilityInformation_t rac;
+
+  if (ueCapabilityInformation->criticalExtensions.present != UECapabilityInformation__criticalExtensions_PR_c1
+      || ueCapabilityInformation->criticalExtensions.choice.c1.present != UECapabilityInformation__criticalExtensions__c1_PR_ueCapabilityInformation_r8) {
+    LOG_E(RRC, "[eNB %d][UE %x] bad UE capabilities\n", ctxt_pP->module_id, ue_context_pP->ue_context.rnti);
+    return;
   }
+
+  asn_enc_rval_t ret = uper_encode_to_buffer(&asn_DEF_UECapabilityInformation, ueCapabilityInformation, buf, 4096);
+  if (ret.encoded == -1) abort();
+
+  memset(&rac, 0, sizeof(UERadioAccessCapabilityInformation_t));
+
+  rac.criticalExtensions.present = UERadioAccessCapabilityInformation__criticalExtensions_PR_c1;
+  rac.criticalExtensions.choice.c1.present = UERadioAccessCapabilityInformation__criticalExtensions__c1_PR_ueRadioAccessCapabilityInformation_r8;
+  rac.criticalExtensions.choice.c1.choice.ueRadioAccessCapabilityInformation_r8.ue_RadioAccessCapabilityInfo.buf = buf;
+  rac.criticalExtensions.choice.c1.choice.ueRadioAccessCapabilityInformation_r8.ue_RadioAccessCapabilityInfo.size = (ret.encoded+7)/8;
+  rac.criticalExtensions.choice.c1.choice.ueRadioAccessCapabilityInformation_r8.nonCriticalExtension = NULL;
+
+  /* 8192 is arbitrary, should be big enough */
+  buf2 = malloc16(8192);
+  if (buf2 == NULL) abort();
+  ret = uper_encode_to_buffer(&asn_DEF_UERadioAccessCapabilityInformation, &rac, buf2, 8192);
+  if (ret.encoded == -1) abort();
+
+  MessageDef *msg_p;
+
+  msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_UE_CAPABILITIES_IND);
+  S1AP_UE_CAPABILITIES_IND (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id;
+  S1AP_UE_CAPABILITIES_IND (msg_p).ue_radio_cap.length = (ret.encoded+7)/8;
+  S1AP_UE_CAPABILITIES_IND (msg_p).ue_radio_cap.buffer = buf2;
+
+  itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p);
 }
 
 //------------------------------------------------------------------------------
@@ -757,12 +774,15 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS(
   uint32_t eNB_ue_s1ap_id;
   uint32_t length;
   uint8_t *buffer;
-
+  uint8_t srb_id; 
+  
   struct rrc_eNB_ue_context_s* ue_context_p = NULL;
   protocol_ctxt_t              ctxt;
   ue_initial_id = S1AP_DOWNLINK_NAS (msg_p).ue_initial_id;
   eNB_ue_s1ap_id = S1AP_DOWNLINK_NAS (msg_p).eNB_ue_s1ap_id;
   ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id);
+  srb_id = ue_context_p->ue_context.Srb2.Srb_info.Srb_id;
+  
   LOG_I(RRC, "[eNB %d] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d\n",
         instance,
         msg_name,
@@ -843,10 +863,13 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS(
 
     LOG_F(RRC,"\n");
 #endif
+    /* 
+     * switch UL or DL NAS message without RRC piggybacked to SRB2 if active. 
+     */
     /* Transfer data to PDCP */
     rrc_data_req (
 		  &ctxt,
-		  DCCH,
+		  srb_id,
 		  *rrc_eNB_mui++,
 		  SDU_CONFIRM_NO,
 		  length,
@@ -898,7 +921,7 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char
 
       memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req));
       ue_context_p->ue_context.nb_of_e_rabs = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_e_rabs;
-
+     
       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 = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i];
@@ -911,7 +934,7 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char
                &S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i].sgw_addr,
                sizeof(transport_layer_addr_t));
       }
-
+    
       create_tunnel_req.rnti       = ue_context_p->ue_context.rnti; // warning put zero above
       create_tunnel_req.num_tunnels    = i;
 
@@ -922,7 +945,8 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char
 
       rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
           &ctxt,
-          &create_tunnel_resp);
+          &create_tunnel_resp); 
+      ue_context_p->ue_context.setup_e_rabs=ue_context_p->ue_context.nb_of_e_rabs;
     }
 
     /* TODO parameters yet to process ... */
@@ -1231,6 +1255,183 @@ int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND (MessageDef *msg_p, const ch
   }
 }
 
+int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance)
+{
+  uint16_t                        ue_initial_id;
+  uint32_t                        eNB_ue_s1ap_id;
+  MessageDef                     *message_gtpv1u_p = NULL;
+  gtpv1u_enb_create_tunnel_req_t  create_tunnel_req;
+  gtpv1u_enb_create_tunnel_resp_t create_tunnel_resp;
+
+  struct rrc_eNB_ue_context_s* ue_context_p = NULL;
+  protocol_ctxt_t              ctxt;
+  ue_initial_id  = S1AP_E_RAB_SETUP_REQ (msg_p).ue_initial_id;
+  eNB_ue_s1ap_id = S1AP_E_RAB_SETUP_REQ (msg_p).eNB_ue_s1ap_id;
+  ue_context_p   = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id);
+  LOG_I(RRC, "[eNB %d] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d, nb_of_e_rabs %d\n",
+        instance, msg_name, ue_initial_id, eNB_ue_s1ap_id, S1AP_E_RAB_SETUP_REQ (msg_p).nb_e_rabs_tosetup);
+
+  if (ue_context_p == NULL) {
+    /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */
+    MessageDef *msg_fail_p = NULL;
+
+    LOG_W(RRC, "[eNB %d] In S1AP_E_RAB_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id);
+
+    msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_SETUP_REQUEST_FAIL);
+    S1AP_E_RAB_SETUP_REQ  (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id;
+
+    // TODO add failure cause when defined!
+
+    itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p);
+    return (-1);
+  } else {
+
+    PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0);
+    ue_context_p->ue_context.eNB_ue_s1ap_id = S1AP_E_RAB_SETUP_REQ  (msg_p).eNB_ue_s1ap_id;
+
+    /* Save e RAB information for later */
+    {
+      int i;
+
+      memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req));
+      uint8_t nb_e_rabs_tosetup = S1AP_E_RAB_SETUP_REQ  (msg_p).nb_e_rabs_tosetup;
+
+      // keep the previous bearer
+      // the index for the rec
+      for (i = 0; 
+	   i < nb_e_rabs_tosetup; 
+	   i++) {
+	if (ue_context_p->ue_context.e_rab[i+ue_context_p->ue_context.setup_e_rabs].status == E_RAB_STATUS_DONE) 
+	  LOG_W(RRC,"E-RAB already configured, reconfiguring\n");
+        ue_context_p->ue_context.e_rab[i+ue_context_p->ue_context.setup_e_rabs].status = E_RAB_STATUS_NEW;
+        ue_context_p->ue_context.e_rab[i+ue_context_p->ue_context.setup_e_rabs].param = S1AP_E_RAB_SETUP_REQ  (msg_p).e_rab_setup_params[i];
+
+
+        create_tunnel_req.eps_bearer_id[i]       = S1AP_E_RAB_SETUP_REQ  (msg_p).e_rab_setup_params[i].e_rab_id;
+        create_tunnel_req.sgw_S1u_teid[i]        = S1AP_E_RAB_SETUP_REQ  (msg_p).e_rab_setup_params[i].gtp_teid;
+
+        memcpy(&create_tunnel_req.sgw_addr[i],
+               & S1AP_E_RAB_SETUP_REQ (msg_p).e_rab_setup_params[i].sgw_addr,
+               sizeof(transport_layer_addr_t));
+	
+	LOG_I(RRC,"E_RAB setup REQ: local index %d teid %u, eps id %d \n", 
+	      i+ue_context_p->ue_context.setup_e_rabs,
+	      create_tunnel_req.sgw_S1u_teid[i],
+	       create_tunnel_req.eps_bearer_id[i] );
+      }
+      ue_context_p->ue_context.nb_of_e_rabs=nb_e_rabs_tosetup;
+     
+     
+      create_tunnel_req.rnti       = ue_context_p->ue_context.rnti; // warning put zero above
+      create_tunnel_req.num_tunnels    = i;
+      
+      // NN: not sure if we should create a new tunnel: need to check teid, etc.
+      gtpv1u_create_s1u_tunnel(
+        instance,
+        &create_tunnel_req,
+        &create_tunnel_resp);
+
+      rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(
+          &ctxt,
+          &create_tunnel_resp);
+
+      ue_context_p->ue_context.setup_e_rabs+=nb_e_rabs_tosetup;
+
+    }
+
+    /* TODO parameters yet to process ... */
+    {
+      //      S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_ambr;
+    }
+
+    rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(&ctxt, ue_context_p, 0);
+							 
+    return (0);
+  }
+}
+
+/*NN: careful about the typcast of xid (long -> uint8_t*/
+int rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(const protocol_ctxt_t* const ctxt_pP,
+				   rrc_eNB_ue_context_t*          const ue_context_pP,
+				   uint8_t xid ){  
+
+  MessageDef      *msg_p         = NULL;
+  int e_rab;
+  int e_rabs_done = 0;
+  int e_rabs_failed = 0;
+    
+  msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_SETUP_RESP);
+  S1AP_E_RAB_SETUP_RESP (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id;
+ 
+  for (e_rab = 0; e_rab <  ue_context_pP->ue_context.setup_e_rabs ; e_rab++) {
+
+    /* only respond to the corresponding transaction */ 
+    //if (((xid+1)%4) == ue_context_pP->ue_context.e_rab[e_rab].xid) {
+    if (xid == ue_context_pP->ue_context.e_rab[e_rab].xid) {
+      
+      if (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) {
+     
+	S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id;
+	// TODO add other information from S1-U when it will be integrated
+	S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].gtp_teid = ue_context_pP->ue_context.enb_gtp_teid[e_rab];
+	S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr = ue_context_pP->ue_context.enb_gtp_addrs[e_rab];
+	//S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr.length += 4;
+	ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED;
+	
+	LOG_I (RRC,"enb_gtp_addr (msg index %d, e_rab index %d, status %d, xid %d): nb_of_e_rabs %d,  e_rab_id %d, teid: %u, addr: %d.%d.%d.%d \n ",
+	       e_rabs_done,  e_rab, ue_context_pP->ue_context.e_rab[e_rab].status, xid,
+	       ue_context_pP->ue_context.nb_of_e_rabs,
+	       S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id,
+	       S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].gtp_teid,
+	       S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[0],
+	       S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[1],
+	       S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[2],
+	       S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[3]);
+	
+	e_rabs_done++;
+      } else if ((ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_NEW)  || 
+		 (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_ESTABLISHED)){
+	LOG_D (RRC,"E-RAB is NEW or already ESTABLISHED\n");
+      }else { /* to be improved */
+	ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED;
+	S1AP_E_RAB_SETUP_RESP  (msg_p).e_rabs_failed[e_rabs_failed].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id;
+	e_rabs_failed++;
+	// TODO add cause when it will be integrated
+      }
+      
+      
+      S1AP_E_RAB_SETUP_RESP (msg_p).nb_of_e_rabs = e_rabs_done;
+      S1AP_E_RAB_SETUP_RESP (msg_p).nb_of_e_rabs_failed = e_rabs_failed;
+      // NN: add conditions for e_rabs_failed 
+      if ((e_rabs_done > 0) ){  
+
+	LOG_I(RRC,"S1AP_E_RAB_SETUP_RESP: sending the message: nb_of_erabs %d, total e_rabs %d, index %d\n",
+	      ue_context_pP->ue_context.nb_of_e_rabs, ue_context_pP->ue_context.setup_e_rabs, e_rab);
+	MSC_LOG_TX_MESSAGE(
+			   MSC_RRC_ENB,
+			   MSC_S1AP_ENB,
+			   (const char *)&S1AP_E_RAB_SETUP_RESP (msg_p),
+			   sizeof(s1ap_e_rab_setup_resp_t),
+			   MSC_AS_TIME_FMT" E_RAB_SETUP_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail",
+			   MSC_AS_TIME_ARGS(ctxt_pP),
+			   ue_context_pP->ue_id_rnti,
+			   S1AP_E_RAB_SETUP_RESP (msg_p).eNB_ue_s1ap_id,
+			   e_rabs_done, e_rabs_failed);
+	
+	
+	itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p);
+      }
+
+    } else {
+      /*debug info for the xid */ 
+      LOG_D(RRC,"xid does not corresponds  (context e_rab index %d, status %d, xid %d/%d) \n ",
+      	     e_rab, ue_context_pP->ue_context.e_rab[e_rab].status, xid, ue_context_pP->ue_context.e_rab[e_rab].xid);
+    }
+    
+  }
+  
+  return 0;
+}
 
 # endif /* defined(ENABLE_ITTI) */
 #endif /* defined(ENABLE_USE_MME) */
diff --git a/openair2/RRC/LITE/rrc_eNB_S1AP.h b/openair2/RRC/LITE/rrc_eNB_S1AP.h
index 93a213c06fbcec73bd74f95c70e44fa2ae20f97e..0beebc72c1e5533da461ed3fa4249e5bbfff9444 100644
--- a/openair2/RRC/LITE/rrc_eNB_S1AP.h
+++ b/openair2/RRC/LITE/rrc_eNB_S1AP.h
@@ -166,6 +166,25 @@ int rrc_eNB_process_S1AP_DOWNLINK_NAS(MessageDef *msg_p, const char *msg_name, i
  */
 int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance);
 
+
+/*! \fn rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance);
+ *\brief process a S1AP dedicated E_RAB setup request message received from S1AP.
+ *\param msg_p Message received by RRC.
+ *\param msg_name Message name.
+ *\param instance Message instance.
+ *\return 0 when successful, -1 if the UE index can not be retrieved.
+ */
+int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance);
+
+/*! \fn rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t*  const ue_context_pP, uint8_t xid )
+ *\brief send a S1AP dedicated E_RAB setup response
+ *\param ctxt_pP contxt infirmation
+ *\param e_contxt_pP ue specific context at the eNB
+ *\param xid transaction identifier 
+ *\return 0 when successful, -1 if the UE index can not be retrieved.
+ */
+int rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t*  const ue_context_pP, uint8_t xid );  
+
 /*! \fn rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance)
  *\brief process a S1AP_UE_CTXT_MODIFICATION_REQ message received from S1AP.
  *\param msg_p Message received by RRC.
diff --git a/openair2/UTIL/MEM/mem_block.h b/openair2/UTIL/MEM/mem_block.h
index edcb147cee0f33df478070305745d1726043708b..01a05a786ba31033d0f12ead401c98e9a2740482 100755
--- a/openair2/UTIL/MEM/mem_block.h
+++ b/openair2/UTIL/MEM/mem_block.h
@@ -75,7 +75,8 @@ public_mem_block(void         check_mem_area (void);)
 private_mem_block(void        check_free_mem_block (mem_block_t * leP);)
 #    endif
 #ifdef USER_MODE
-#    define MEM_SCALE /*MAX_RG */ MAX_MOBILES_PER_ENB
+//#    define MEM_SCALE MAX_MOBILES_PER_ENB*NB_RB_MAX
+#    define MEM_SCALE MAX_MOBILES_PER_ENB
 #else
 #    ifdef NODE_RG
 #        define MEM_SCALE 2
diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c
index 9f2475ef37b204abb3f215d4778bf816b29cdd2c..397be865a3f35616964c6218ef73a391824e6576 100644
--- a/openair3/GTPV1-U/gtpv1u_eNB.c
+++ b/openair3/GTPV1-U/gtpv1u_eNB.c
@@ -28,7 +28,7 @@
  *******************************************************************************/
 /*! \file gtpv1u_eNB.c
  * \brief
- * \author Sebastien ROUX, Lionel GAUTHIER
+ * \author Sebastien ROUX, Lionel GAUTHIER, Navid Nikaein
  * \version 1.0
  * \company Eurecom
  * \email: lionel.gauthier@eurecom.fr
@@ -289,7 +289,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req(
   NwGtpv1uUlpHandleT hUlp,
   NwGtpv1uUlpApiT   *pUlpApi)
 {
-  int                 result             = 0;
+  boolean_t           result             = FALSE;
   teid_t              teid               = 0;
   hashtable_rc_t      hash_rc            = HASH_TABLE_KEY_NOT_EXISTS;
   gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL;
@@ -335,38 +335,49 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req(
 
 //#warning "LG eps bearer mapping to DRB id to do (offset -4)"
       PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gtpv1u_teid_data_p->enb_id, ENB_FLAG_YES,  gtpv1u_teid_data_p->ue_id, 0, 0,gtpv1u_teid_data_p->enb_id);
-
       MSC_LOG_TX_MESSAGE(
-    		  MSC_GTPU_ENB,
-    		  MSC_PDCP_ENB,
-    		  NULL,0,
-    		  MSC_AS_TIME_FMT" DATA-REQ rb %u size %u",
-    		  0,0,
-    		  (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4,
-    		  buffer_len);
-
+			 MSC_GTPU_ENB,
+			 MSC_PDCP_ENB,
+			 NULL,0,
+			 MSC_AS_TIME_FMT" DATA-REQ rb %u size %u",
+			 0,0,
+			 (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4,
+			 buffer_len);
+      
       result = pdcp_data_req(
-                 &ctxt,
-                 SRB_FLAG_NO,
-                 (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4,
-                 0, // mui
-                 SDU_CONFIRM_NO, // confirm
-                 buffer_len,
-                 buffer,
-                 PDCP_TRANSMISSION_MODE_DATA);
-      AssertError (result == TRUE, return NW_GTPV1U_FAILURE ,"PDCP data request failed!\n");
+			     &ctxt,
+			     SRB_FLAG_NO,
+			     (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4,
+			     0, // mui
+			     SDU_CONFIRM_NO, // confirm
+			     buffer_len,
+			     buffer,
+			     PDCP_TRANSMISSION_MODE_DATA);
+      
+      
+      if ( result == FALSE ) {
+	
+	if (ctxt.configured == FALSE )
+	  LOG_W(GTPU, "PDCP data request failed, cause: RB is not configured!\n") ;
+	else  
+	  LOG_W(GTPU, "PDCP data request failed\n");
+	
+	return NW_GTPV1U_FAILURE;
+      }
+      
     } else {
-      LOG_E(GTPU, "Received T-PDU from gtpv1u stack teid %u unknown size %u", teid, buffer_len);
+      LOG_W(GTPU, "Received T-PDU from gtpv1u stack teid %u unknown size %u", teid, buffer_len);
     }
   }
-  break;
-
+    break;
+    
   default: {
     LOG_E(GTPU, "Received undefined UlpApi (%02x) from gtpv1u stack!\n",
           pUlpApi->apiType);
   }
-  }
-
+  
+  } // end of switch 
+  
   return NW_GTPV1U_OK;
 }
 
diff --git a/openair3/NAS/UE/API/USIM/aka_functions.c b/openair3/NAS/UE/API/USIM/aka_functions.c
index 1c30a17bfd505254e1b37436d55dca259a527aab..1c2dbb6d91640faa4c86acb82287d4c356962520 100644
--- a/openair3/NAS/UE/API/USIM/aka_functions.c
+++ b/openair3/NAS/UE/API/USIM/aka_functions.c
@@ -306,6 +306,11 @@ void ComputeOPc( u8 op_c_pP[16] )
 
   for (i=0; i<16; i++)
     op_c_pP[i] ^= OP[i];
+  LOG_TRACE(DEBUG,
+            "USIM-API  - OPc[0..15]=%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
+            op_c_pP[0],op_c_pP[1],op_c_pP[2], op_c_pP[3], op_c_pP[4], op_c_pP[5], op_c_pP[6], op_c_pP[7],
+            op_c_pP[8],op_c_pP[9],op_c_pP[10],op_c_pP[11],op_c_pP[12],op_c_pP[13],op_c_pP[14],op_c_pP[15]);
+
 
   return;
 } /* end of function ComputeOPc */
diff --git a/openair3/NAS/UE/API/USIM/usim_api.c b/openair3/NAS/UE/API/USIM/usim_api.c
index fe8dc8b35074b8b38c745e7bab232bcfb29f356f..807ee467242e030694a2c3c12e5bb49ff5721d53 100644
--- a/openair3/NAS/UE/API/USIM/usim_api.c
+++ b/openair3/NAS/UE/API/USIM/usim_api.c
@@ -77,7 +77,8 @@ Description Implements the API used by the NAS layer to read/write
  * Subscriber authentication security key
  */
 #define USIM_API_K_SIZE         16
-#define USIM_API_K_VALUE        "fec86ba6eb707ed08905757b1bb44b8f"
+//#define USIM_API_K_VALUE        "fec86ba6eb707ed08905757b1bb44b8f"
+#define USIM_API_K_VALUE        "8BAF473F2F8FD09487CCCBD7097C6862"
 
 static uint8_t _usim_api_k[USIM_API_K_SIZE];
 
diff --git a/openair3/S1AP/MESSAGES/ASN1/asn1cpatch.p0 b/openair3/S1AP/MESSAGES/ASN1/asn1cpatch.p0
deleted file mode 100644
index b3a5b8d39f5059fabb85b65f03f23ea8f6760784..0000000000000000000000000000000000000000
--- a/openair3/S1AP/MESSAGES/ASN1/asn1cpatch.p0
+++ /dev/null
@@ -1,5082 +0,0 @@
-Index: asn1c/unber.c
-===================================================================
---- asn1c/unber.c	(revision 1516)
-+++ asn1c/unber.c	(working copy)
-@@ -775,4 +775,8 @@
- 
- asn_enc_rval_t OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts, void *sptr, asn_per_outp_t *po) { asn_enc_rval_t er = { 0, 0, 0 }; (void)td; (void)cts; (void)sptr; (void)po; return er; }
- 
-+asn_dec_rval_t OCTET_STRING_decode_aper(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rv = { 0, 0 }; (void)ctx; (void)td; (void)cts; (void)sptr; (void)pd; return rv; }
-+
-+asn_enc_rval_t OCTET_STRING_encode_aper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts, void *sptr, asn_per_outp_t *po) { asn_enc_rval_t er = { 0, 0, 0 }; (void)td; (void)cts; (void)sptr; (void)po; return er; }
-+
- size_t xer_whitespace_span(const void *chunk_buf, size_t chunk_size) {  (void)chunk_buf; (void)chunk_size; return 0; }
-Index: asn1c/asn1c.c
-===================================================================
---- asn1c/asn1c.c	(revision 1516)
-+++ asn1c/asn1c.c	(working copy)
-@@ -111,6 +111,8 @@
- 			asn1_compiler_flags &= ~A1C_LINK_SKELETONS;
- 		} else if(strcmp(optarg, "link-skeletons") == 0) {
- 			asn1_compiler_flags |= A1C_LINK_SKELETONS;
-+		} else if(strcmp(optarg, "have_native64") == 0) {
-+			asn1_compiler_flags |= A1C_HAVE_NATIVE_64;
- 		} else {
- 			fprintf(stderr, "-f%s: Invalid argument\n", optarg);
- 			exit(EX_USAGE);
-@@ -471,6 +473,7 @@
- "  -fno-include-deps     Do not generate courtesy #includes for dependencies\n"
- "  -funnamed-unions      Enable unnamed unions in structures\n"
- "  -fwide-types          Use INTEGER_t instead of \"long\" by default, etc.\n"
-+"  -fhave_native64       Use int64_t/uint64_t for target platform\n"
- "\n"
- 
- "  -gen-PER              Generate PER support code\n"
-Index: examples/README
-===================================================================
---- examples/README	(revision 1516)
-+++ examples/README	(working copy)
-@@ -25,6 +25,8 @@
-    UserPlane Location Protocol decoder. Before trying to compile, read the
-    README file in that directory.
- 
-+The clyx2asn1.pl script can be used to extract ASN.1 data from LyX editor files.
-+
- The crfc2asn1.pl script can be used to extract ASN.1 data from RFC texts.
- For instance, it is used to extract X.509, MEGACO, and LDAPv3 ASN.1 modules
- from the corresponding RFC texts (rfc3280.txt, rfc3525.txt, rfc4211.txt).
-Index: skeletons/UTF8String.c
-===================================================================
---- skeletons/UTF8String.c	(revision 1516)
-+++ skeletons/UTF8String.c	(working copy)
-@@ -25,6 +25,8 @@
- 	OCTET_STRING_encode_xer_utf8,
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_UTF8String_tags,
- 	sizeof(asn_DEF_UTF8String_tags)
-Index: skeletons/constr_TYPE.h
-===================================================================
---- skeletons/constr_TYPE.h	(revision 1516)
-+++ skeletons/constr_TYPE.h	(working copy)
-@@ -99,6 +99,8 @@
- 	xer_type_encoder_f *xer_encoder;	/* [Canonical] XER encoder */
- 	per_type_decoder_f *uper_decoder;	/* Unaligned PER decoder */
- 	per_type_encoder_f *uper_encoder;	/* Unaligned PER encoder */
-+	per_type_decoder_f *aper_decoder;	/* Aligned PER decoder */
-+	per_type_encoder_f *aper_encoder;	/* Aligned PER encoder */
- 
- 	/***********************************************************************
- 	 * Internally useful members. Not to be used by applications directly. *
-Index: skeletons/RELATIVE-OID.c
-===================================================================
---- skeletons/RELATIVE-OID.c	(revision 1516)
-+++ skeletons/RELATIVE-OID.c	(working copy)
-@@ -28,6 +28,8 @@
- 	RELATIVE_OID_encode_xer,
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_RELATIVE_OID_tags,
- 	sizeof(asn_DEF_RELATIVE_OID_tags)
-Index: skeletons/per_encoder.c
-===================================================================
---- skeletons/per_encoder.c	(revision 1516)
-+++ skeletons/per_encoder.c	(working copy)
-@@ -4,6 +4,7 @@
- 
- static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *, void *sptr, asn_app_consume_bytes_f *cb, void *app_key);
- 
-+static asn_enc_rval_t aper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *, void *sptr, asn_app_consume_bytes_f *cb, void *app_key);
- asn_enc_rval_t
- uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) {
- 	return uper_encode_internal(td, 0, sptr, cb, app_key);
-@@ -41,6 +42,18 @@
- 	return uper_encode_internal(td, 0, sptr, encode_to_buffer_cb, &key);
- }
- 
-+asn_enc_rval_t
-+aper_encode_to_buffer(asn_TYPE_descriptor_t *td, void *sptr, void *buffer, size_t buffer_size) {
-+	enc_to_buf_arg key;
-+	
-+	key.buffer = buffer;
-+	key.left = buffer_size;
-+
-+	if(td) ASN_DEBUG("Encoding \"%s\" using ALIGNED PER", td->name);
-+
-+	return aper_encode_internal(td, 0, sptr, encode_to_buffer_cb, &key);
-+}
-+
- typedef struct enc_dyn_arg {
- 	void *buffer;
- 	size_t length;
-@@ -93,6 +106,35 @@
- 	}
- }
- 
-+ssize_t
-+aper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, void **buffer_r) {
-+	asn_enc_rval_t er;
-+	enc_dyn_arg key;
-+	
-+	memset(&key, 0, sizeof(key));
-+	
-+	er = aper_encode_internal(td, constraints, sptr, encode_dyn_cb, &key);
-+	switch(er.encoded) {
-+		case -1:
-+			FREEMEM(key.buffer);
-+			return -1;
-+		case 0:
-+			FREEMEM(key.buffer);
-+			key.buffer = MALLOC(1);
-+			if(key.buffer) {
-+				*(char *)key.buffer = '\0';
-+				*buffer_r = key.buffer;
-+				return 1;
-+			} else {
-+				return -1;
-+			}
-+		default:
-+			*buffer_r = key.buffer;
-+			ASN_DEBUG("Complete encoded in %ld bits", (long)er.encoded);
-+			return ((er.encoded + 7) >> 3);
-+	}
-+}
-+
- /*
-  * Internally useful functions.
-  */
-@@ -115,6 +157,23 @@
- 	return po->outper(po->tmpspace, buf - po->tmpspace, po->op_key);
- }
- 
-+static int
-+_aper_encode_flush_outp(asn_per_outp_t *po) {
-+	uint8_t *buf;
-+
-+	if(po->nboff == 0 && po->buffer == po->tmpspace)
-+		return 0;
-+
-+	buf = po->buffer + (po->nboff >> 3);
-+	/* Make sure we account for the last, partially filled */
-+	if(po->nboff & 0x07) {
-+		buf[0] &= 0xff << (8 - (po->nboff & 0x07));
-+		buf++;
-+	}
-+
-+	return po->outper(po->tmpspace, buf - po->tmpspace, po->op_key);
-+}
-+
- static asn_enc_rval_t
- uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) {
- 	asn_per_outp_t po;
-@@ -149,3 +208,37 @@
- 	return er;
- }
- 
-+static asn_enc_rval_t
-+aper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) {
-+	asn_per_outp_t po;
-+	asn_enc_rval_t er;
-+
-+	/*
-+	 * Invoke type-specific encoder.
-+	 */
-+	if(!td || !td->aper_encoder)
-+		_ASN_ENCODE_FAILED;	 /* PER is not compiled in */
-+
-+	po.buffer = po.tmpspace;
-+	po.nboff = 0;
-+	po.nbits = 8 * sizeof(po.tmpspace);
-+	po.outper = cb;
-+	po.op_key = app_key;
-+	po.flushed_bytes = 0;
-+
-+	er = td->aper_encoder(td, constraints, sptr, &po);
-+	if(er.encoded != -1) {
-+		size_t bits_to_flush;
-+
-+		bits_to_flush = ((po.buffer - po.tmpspace) << 3) + po.nboff;
-+
-+		/* Set number of bits encoded to a firm value */
-+		er.encoded = (po.flushed_bytes << 3) + bits_to_flush;
-+
-+		if(_aper_encode_flush_outp(&po))
-+			_ASN_ENCODE_FAILED;
-+	}
-+
-+	return er;
-+}
-+
-Index: skeletons/NumericString.c
-===================================================================
---- skeletons/NumericString.c	(revision 1516)
-+++ skeletons/NumericString.c	(working copy)
-@@ -49,6 +49,8 @@
- 	OCTET_STRING_encode_xer_utf8,
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_NumericString_tags,
- 	sizeof(asn_DEF_NumericString_tags)
-Index: skeletons/per_encoder.h
-===================================================================
---- skeletons/per_encoder.h	(revision 1516)
-+++ skeletons/per_encoder.h	(working copy)
-@@ -38,6 +38,12 @@
- 	size_t buffer_size	/* Initial buffer size (max) */
- );
- 
-+asn_enc_rval_t aper_encode_to_buffer(
-+	struct asn_TYPE_descriptor_s *type_descriptor,
-+	void *struct_ptr,	   /* Structure to be encoded */
-+	void *buffer,		   /* Pre-allocated buffer */
-+	size_t buffer_size	   /* Initial buffer size (max) */
-+);
- /*
-  * A variant of uper_encode_to_buffer() which allocates buffer itself.
-  * Returns the number of bytes in the buffer or -1 in case of failure.
-@@ -52,6 +58,11 @@
- 	void **buffer_r		/* Buffer allocated and returned */
- );
- 
-+ssize_t
-+aper_encode_to_new_buffer(struct asn_TYPE_descriptor_s *td,
-+						  asn_per_constraints_t *constraints,
-+						  void *sptr,
-+						  void **buffer_r);
- /*
-  * Type of the generic PER encoder function.
-  */
-Index: skeletons/T61String.c
-===================================================================
---- skeletons/T61String.c	(revision 1516)
-+++ skeletons/T61String.c	(working copy)
-@@ -24,6 +24,8 @@
- 	OCTET_STRING_encode_xer,
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_T61String_tags,
- 	sizeof(asn_DEF_T61String_tags)
-Index: skeletons/TeletexString.c
-===================================================================
---- skeletons/TeletexString.c	(revision 1516)
-+++ skeletons/TeletexString.c	(working copy)
-@@ -24,6 +24,8 @@
- 	OCTET_STRING_encode_xer,
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_TeletexString_tags,
- 	sizeof(asn_DEF_TeletexString_tags)
-Index: skeletons/BMPString.c
-===================================================================
---- skeletons/BMPString.c	(revision 1516)
-+++ skeletons/BMPString.c	(working copy)
-@@ -35,6 +35,8 @@
- 	BMPString_encode_xer,		/* Convert to UTF-8 */
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,	/* Aligned PER decoder */
-+	OCTET_STRING_encode_aper,	/* Aligned PER encoder */
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_BMPString_tags,
- 	sizeof(asn_DEF_BMPString_tags)
-Index: skeletons/ObjectDescriptor.c
-===================================================================
---- skeletons/ObjectDescriptor.c	(revision 1516)
-+++ skeletons/ObjectDescriptor.c	(working copy)
-@@ -24,6 +24,8 @@
- 	OCTET_STRING_encode_xer_utf8,
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_ObjectDescriptor_tags,
- 	sizeof(asn_DEF_ObjectDescriptor_tags)
-Index: skeletons/PrintableString.c
-===================================================================
---- skeletons/PrintableString.c	(revision 1516)
-+++ skeletons/PrintableString.c	(working copy)
-@@ -59,6 +59,8 @@
- 	OCTET_STRING_encode_xer_utf8,
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_PrintableString_tags,
- 	sizeof(asn_DEF_PrintableString_tags)
-Index: skeletons/constr_SET_OF.c
-===================================================================
---- skeletons/constr_SET_OF.c	(revision 1516)
-+++ skeletons/constr_SET_OF.c	(working copy)
-@@ -34,7 +34,7 @@
- #undef	ADVANCE
- #define	ADVANCE(num_bytes)	do {		\
- 		size_t num = num_bytes;		\
--		ptr = ((const void *)ptr) + num;\
-+		ptr = ((const char *)ptr) + num;\
- 		size -= num;			\
- 		if(ctx->left >= 0)		\
- 			ctx->left -= num;	\
-@@ -100,7 +100,7 @@
- 	/*
- 	 * Restore parsing context.
- 	 */
--	ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset);
-+	ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
- 	
- 	/*
- 	 * Start to parse where left previously
-@@ -457,7 +457,7 @@
- #undef	XER_ADVANCE
- #define	XER_ADVANCE(num_bytes)	do {			\
- 		size_t num = num_bytes;			\
--		buf_ptr = ((const void *)buf_ptr) + num;\
-+		buf_ptr = ((const char *)buf_ptr) + num;\
- 		size -= num;				\
- 		consumed_myself += num;			\
- 	} while(0)
-@@ -505,7 +505,7 @@
- 	/*
- 	 * Restore parsing context.
- 	 */
--	ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset);
-+	ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
- 
- 	/*
- 	 * Phases of XER/XML processing:
-@@ -627,7 +627,7 @@
- 		t->buffer = p;
- 		t->size = newsize;
- 	}
--	memcpy((void *)t->buffer + t->offset, buffer, size);
-+	memcpy((char *)t->buffer + t->offset, buffer, size);
- 	t->offset += size;
- 	return 0;
- }
-@@ -809,7 +809,7 @@
- 		asn_set_empty(list);	/* Remove (list->array) */
- 
- 		specs = (asn_SET_OF_specifics_t *)td->specifics;
--		ctx = (asn_struct_ctx_t *)((void *)ptr + specs->ctx_offset);
-+		ctx = (asn_struct_ctx_t *)((char *)ptr + specs->ctx_offset);
- 		if(ctx->ptr) {
- 			ASN_STRUCT_FREE(*elm->type, ctx->ptr);
- 			ctx->ptr = 0;
-@@ -884,7 +884,7 @@
- 	if(!st) {
- 		st = *sptr = CALLOC(1, specs->struct_size);
- 		if(!st) _ASN_DECODE_FAILED;
--	}                                                                       
-+	}
- 	list = _A_SET_FROM_VOID(st);
- 
- 	/* Figure out which constraints to use */
-@@ -901,7 +901,7 @@
- 	if(ct && ct->effective_bits >= 0) {
- 		/* X.691, #19.5: No length determinant */
- 		nelems = per_get_few_bits(pd, ct->effective_bits);
--		ASN_DEBUG("Preparing to fetch %ld+%ld elements from %s",
-+		ASN_DEBUG("Preparing to fetch %ld+%"PRIdMAX" elements from %s",
- 			(long)nelems, ct->lower_bound, td->name);
- 		if(nelems < 0)  _ASN_DECODE_STARVED;
- 		nelems += ct->lower_bound;
-@@ -951,3 +951,91 @@
- 	return rv;
- }
- 
-+asn_dec_rval_t
-+SET_OF_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-+				   asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
-+	asn_dec_rval_t rv;
-+	asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics;
-+	asn_TYPE_member_t *elm = td->elements;	/* Single one */
-+	void *st = *sptr;
-+	asn_anonymous_set_ *list;
-+	asn_per_constraint_t *ct;
-+	int repeat = 0;
-+	ssize_t nelems;
-+
-+	if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx))
-+		_ASN_DECODE_FAILED;
-+
-+	/*
-+	 * Create the target structure if it is not present already.
-+	 */
-+	if(!st) {
-+		st = *sptr = CALLOC(1, specs->struct_size);
-+		if(!st) _ASN_DECODE_FAILED;
-+	}
-+	list = _A_SET_FROM_VOID(st);
-+
-+	/* Figure out which constraints to use */
-+	if(constraints) ct = &constraints->size;
-+	else if(td->per_constraints) ct = &td->per_constraints->size;
-+	else ct = 0;
-+
-+	if(ct && ct->flags & APC_EXTENSIBLE) {
-+		int value = per_get_few_bits(pd, 1);
-+		if(value < 0) _ASN_DECODE_STARVED;
-+		if(value) ct = 0;	/* Not restricted! */
-+	}
-+
-+	if(ct && ct->effective_bits >= 0) {
-+		/* X.691, #19.5: No length determinant */
-+// 		nelems = per_get_few_bits(pd, ct->effective_bits);
-+		nelems = aper_get_nsnnwn(pd, ct->upper_bound - ct->lower_bound);
-+		ASN_DEBUG("Preparing to fetch %ld+%"PRIdMAX" elements from %s",
-+			(long)nelems, ct->lower_bound, td->name);
-+		if(nelems < 0)  _ASN_DECODE_STARVED;
-+		nelems += ct->lower_bound;
-+	} else {
-+		nelems = -1;
-+	}
-+
-+	do {
-+		int i;
-+		if(nelems < 0) {
-+			nelems = aper_get_length(pd, ct ? ct->upper_bound - ct->lower_bound + 1 : -1,
-+				ct ? ct->effective_bits : -1, &repeat);
-+			ASN_DEBUG("Got to decode %d elements (eff %d)",
-+				(int)nelems, (int)ct ? ct->effective_bits : -1);
-+			if(nelems < 0) _ASN_DECODE_STARVED;
-+		}
-+
-+		for(i = 0; i < nelems; i++) {
-+			void *ptr = 0;
-+			ASN_DEBUG("SET OF %s decoding", elm->type->name);
-+			rv = elm->type->aper_decoder(opt_codec_ctx, elm->type,
-+				elm->per_constraints, &ptr, pd);
-+			ASN_DEBUG("%s SET OF %s decoded %d, %p",
-+				td->name, elm->type->name, rv.code, ptr);
-+			if(rv.code == RC_OK) {
-+				if(ASN_SET_ADD(list, ptr) == 0)
-+					continue;
-+				ASN_DEBUG("Failed to add element into %s",
-+					td->name);
-+				/* Fall through */
-+				rv.code = RC_FAIL;
-+			} else {
-+				ASN_DEBUG("Failed decoding %s of %s (SET OF)",
-+					elm->type->name, td->name);
-+			}
-+			if(ptr) ASN_STRUCT_FREE(*elm->type, ptr);
-+			return rv;
-+		}
-+
-+		nelems = -1;	/* Allow uper_get_length() */
-+	} while(repeat);
-+
-+	ASN_DEBUG("Decoded %s as SET OF", td->name);
-+
-+	rv.code = RC_OK;
-+	rv.consumed = 0;
-+	return rv;
-+}
-Index: skeletons/NULL.c
-===================================================================
---- skeletons/NULL.c	(revision 1516)
-+++ skeletons/NULL.c	(working copy)
-@@ -25,6 +25,8 @@
- 	NULL_encode_xer,
- 	NULL_decode_uper,	/* Unaligned PER decoder */
- 	NULL_encode_uper,	/* Unaligned PER encoder */
-+	NULL_decode_aper,	/* Aligned PER decoder */
-+	NULL_encode_aper,	/* Aligned PER encoder */
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_NULL_tags,
- 	sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]),
-@@ -135,6 +137,34 @@
- 	return rv;
- }
- 
-+asn_dec_rval_t
-+NULL_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
-+	asn_dec_rval_t rv;
-+
-+	(void)opt_codec_ctx;
-+	(void)td;
-+	(void)constraints;
-+	(void)pd;
-+
-+	if(!*sptr) {
-+		*sptr = MALLOC(sizeof(NULL_t));
-+		if(*sptr) {
-+			*(NULL_t *)*sptr = 0;
-+		} else {
-+			_ASN_DECODE_FAILED;
-+		}
-+	}
-+
-+	/*
-+	 * NULL type does not have content octets.
-+	 */
-+
-+	rv.code = RC_OK;
-+	rv.consumed = 0;
-+	return rv;
-+}
-+
- asn_enc_rval_t
- NULL_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
- 		void *sptr, asn_per_outp_t *po) {
-@@ -148,3 +178,17 @@
- 	er.encoded = 0;
- 	_ASN_ENCODED_OK(er);
- }
-+
-+asn_enc_rval_t
-+NULL_encode_aper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
-+	void *sptr, asn_per_outp_t *po) {
-+	asn_enc_rval_t er;
-+
-+	(void)td;
-+	(void)constraints;
-+	(void)sptr;
-+	(void)po;
-+	
-+	er.encoded = 0;
-+	_ASN_ENCODED_OK(er);
-+}
-Index: skeletons/per_decoder.c
-===================================================================
---- skeletons/per_decoder.c	(revision 1516)
-+++ skeletons/per_decoder.c	(working copy)
-@@ -37,6 +37,35 @@
- }
- 
- asn_dec_rval_t
-+aper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size) {
-+	asn_dec_rval_t rval;
-+	
-+	rval = aper_decode(opt_codec_ctx, td, sptr, buffer, size, 0, 0);
-+	if(rval.consumed) {
-+		/*
-+		 * We've always given 8-aligned data,
-+		 * so convert bits to integral bytes.
-+		 */
-+		rval.consumed += 7;
-+		rval.consumed >>= 3;
-+	} else if(rval.code == RC_OK) {
-+		if(size) {
-+			if(((const uint8_t *)buffer)[0] == 0) {
-+				rval.consumed = 1;	/* 1 byte */
-+			} else {
-+				ASN_DEBUG("Expecting single zeroed byte");
-+				rval.code = RC_FAIL;
-+			}
-+		} else {
-+			/* Must contain at least 8 bits. */
-+			rval.code = RC_WMORE;
-+		}
-+	}
-+	
-+	return rval;
-+}
-+
-+asn_dec_rval_t
- uper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size, int skip_bits, int unused_bits) {
- 	asn_codec_ctx_t s_codec_ctx;
- 	asn_dec_rval_t rval;
-@@ -91,3 +120,57 @@
- 	return rval;
- }
- 
-+asn_dec_rval_t
-+aper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size, int skip_bits, int unused_bits) {
-+	asn_codec_ctx_t s_codec_ctx;
-+	asn_dec_rval_t rval;
-+	asn_per_data_t pd;
-+	
-+	if(skip_bits < 0 || skip_bits > 7
-+		|| unused_bits < 0 || unused_bits > 7
-+		|| (unused_bits > 0 && !size))
-+		_ASN_DECODE_FAILED;
-+	
-+	/*
-+	 * Stack checker requires that the codec context
-+	 * must be allocated on the stack.
-+	 */
-+	if(opt_codec_ctx) {
-+		if(opt_codec_ctx->max_stack_size) {
-+			s_codec_ctx = *opt_codec_ctx;
-+			opt_codec_ctx = &s_codec_ctx;
-+		}
-+	} else {
-+		/* If context is not given, be security-conscious anyway */
-+		memset(&s_codec_ctx, 0, sizeof(s_codec_ctx));
-+		s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX;
-+		opt_codec_ctx = &s_codec_ctx;
-+	}
-+	
-+	/* Fill in the position indicator */
-+	memset(&pd, 0, sizeof(pd));
-+	pd.buffer = (const uint8_t *)buffer;
-+	pd.nboff = skip_bits;
-+	pd.nbits = 8 * size - unused_bits; /* 8 is CHAR_BIT from <limits.h> */
-+	if(pd.nboff > pd.nbits)
-+		_ASN_DECODE_FAILED;
-+	
-+	/*
-+	 * Invoke type-specific decoder.
-+	 */
-+	if(!td->aper_decoder)
-+		_ASN_DECODE_FAILED;	/* PER is not compiled in */
-+		rval = td->aper_decoder(opt_codec_ctx, td, 0, sptr, &pd);
-+	if(rval.code == RC_OK) {
-+		/* Return the number of consumed bits */
-+		rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3)
-+		+ pd.nboff - skip_bits;
-+		ASN_DEBUG("PER decoding consumed %d, counted %d",
-+				  rval.consumed, pd.moved);
-+		assert(rval.consumed == pd.moved);
-+	} else {
-+		/* PER codec is not a restartable */
-+		rval.consumed = 0;
-+	}
-+	return rval;
-+}
-Index: skeletons/constr_SET_OF.h
-===================================================================
---- skeletons/constr_SET_OF.h	(revision 1516)
-+++ skeletons/constr_SET_OF.h	(working copy)
-@@ -34,6 +34,8 @@
- xer_type_encoder_f SET_OF_encode_xer;
- per_type_decoder_f SET_OF_decode_uper;
- per_type_encoder_f SET_OF_encode_uper;
-+per_type_decoder_f SET_OF_decode_aper;
-+per_type_encoder_f SET_OF_encode_aper;
- 
- #ifdef __cplusplus
- }
-Index: skeletons/NULL.h
-===================================================================
---- skeletons/NULL.h	(revision 1516)
-+++ skeletons/NULL.h	(working copy)
-@@ -25,6 +25,8 @@
- xer_type_encoder_f NULL_encode_xer;
- per_type_decoder_f NULL_decode_uper;
- per_type_encoder_f NULL_encode_uper;
-+per_type_decoder_f NULL_decode_aper;
-+per_type_encoder_f NULL_encode_aper;
- 
- #ifdef __cplusplus
- }
-Index: skeletons/per_decoder.h
-===================================================================
---- skeletons/per_decoder.h	(revision 1516)
-+++ skeletons/per_decoder.h	(working copy)
-@@ -38,8 +38,30 @@
- 	int unused_bits		/* Number of unused tailing bits, 0..7 */
- 	);
- 
-+/*
-+ * Aligned PER decoder of a "complete encoding" as per X.691#10.1.
-+ * On success, this call always returns (.consumed >= 1), as per X.691#10.1.3.
-+ */
-+asn_dec_rval_t aper_decode_complete(struct asn_codec_ctx_s *opt_codec_ctx,
-+									struct asn_TYPE_descriptor_s *type_descriptor,	/* Type to decode */
-+									void **struct_ptr,	/* Pointer to a target structure's pointer */
-+									const void *buffer,	/* Data to be decoded */
-+									size_t size		/* Size of data buffer */
-+									);
- 
- /*
-+ * Aligned PER decoder of any ASN.1 type. May be invoked by the application.
-+ * WARNING: This call returns the number of BITS read from the stream. Beware.
-+ */
-+asn_dec_rval_t aper_decode(struct asn_codec_ctx_s *opt_codec_ctx,
-+						   struct asn_TYPE_descriptor_s *type_descriptor,	/* Type to decode */
-+						   void **struct_ptr,	/* Pointer to a target structure's pointer */
-+						   const void *buffer,	/* Data to be decoded */
-+						   size_t size,		/* Size of data buffer */
-+						   int skip_bits,		/* Number of unused leading bits, 0..7 */
-+						   int unused_bits		/* Number of unused tailing bits, 0..7 */
-+					       );
-+/*
-  * Type of the type-specific PER decoder function.
-  */
- typedef asn_dec_rval_t (per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx,
-Index: skeletons/per_support.c
-===================================================================
---- skeletons/per_support.c	(revision 1516)
-+++ skeletons/per_support.c	(working copy)
-@@ -31,6 +31,16 @@
- 	}
- }
- 
-+int32_t
-+aper_get_align(asn_per_data_t *pd) {
-+
-+	if(pd->nboff & 0x7) {
-+		ASN_DEBUG("Aligning %d bits", 8 - (pd->nboff & 0x7));
-+		return per_get_few_bits(pd, 8 - (pd->nboff & 0x7));
-+	}
-+	return 0;
-+}
-+
- /*
-  * Extract a small number of bits (<= 31) from the specified PER data pointer.
-  */
-@@ -187,6 +197,36 @@
- 	return (16384 * value);
- }
- 
-+ssize_t
-+aper_get_length(asn_per_data_t *pd, int range, int ebits, int *repeat) {
-+	ssize_t value;
-+
-+	*repeat = 0;
-+
-+	if (range <= 65536 && range >= 0)
-+		return aper_get_nsnnwn(pd, range);
-+
-+	if (aper_get_align(pd) < 0)
-+		return -1;
-+
-+	if(ebits >= 0) return per_get_few_bits(pd, ebits);
-+
-+	value = per_get_few_bits(pd, 8);
-+	if(value < 0) return -1;
-+	if((value & 128) == 0)  /* #10.9.3.6 */
-+		return (value & 0x7F);
-+	if((value & 64) == 0) { /* #10.9.3.7 */
-+		value = ((value & 63) << 8) | per_get_few_bits(pd, 8);
-+		if(value < 0) return -1;
-+		return value;
-+	}
-+	value &= 63;	/* this is "m" from X.691, #10.9.3.8 */
-+	if(value < 1 || value > 4)
-+		return -1;
-+	*repeat = 1;
-+	return (16384 * value);
-+}
-+
- /*
-  * Get the normally small length "n".
-  * This procedure used to decode length of extensions bit-maps
-@@ -211,6 +251,25 @@
- 	}
- }
- 
-+ssize_t
-+aper_get_nslength(asn_per_data_t *pd) {
-+	ssize_t length;
-+
-+	ASN_DEBUG("Getting normally small length");
-+
-+	if(per_get_few_bits(pd, 1) == 0) {
-+		length = per_get_few_bits(pd, 6) + 1;
-+		if(length <= 0) return -1;
-+		ASN_DEBUG("l=%d", length);
-+		return length;
-+	} else {
-+		int repeat;
-+		length = aper_get_length(pd, -1, -1, &repeat);
-+		if(length >= 0 && !repeat) return length;
-+		return -1; /* Error, or do not support >16K extensions */
-+	}
-+}
-+
- /*
-  * Get the normally small non-negative whole number.
-  * X.691, #10.6
-@@ -237,6 +296,40 @@
- 	return value;
- }
- 
-+ssize_t
-+aper_get_nsnnwn(asn_per_data_t *pd, int range) {
-+	ssize_t value;
-+	int bytes = 0;
-+
-+	ASN_DEBUG("getting nsnnwn with range %d", range);
-+
-+	if(range <= 255) {
-+		if (range < 0) return -1;
-+		/* 1 -> 8 bits */
-+		int i;
-+		for (i = 1; i <= 8; i++) {
-+			int upper = 1 << i;
-+			if (upper >= range)
-+				break;
-+		}
-+		value = per_get_few_bits(pd, i);
-+		return value;
-+	} else if (range == 256){
-+		/* 1 byte */
-+		bytes = 1;
-+		return -1;
-+	} else if (range <= 65536) {
-+		/* 2 bytes */
-+		bytes = 2;
-+	} else {
-+		return -1;
-+	}
-+	if (aper_get_align(pd) < 0)
-+		return -1;
-+	value = per_get_few_bits(pd, 8 * bytes);
-+	return value;
-+}
-+
- /*
-  * Put the normally small non-negative whole number.
-  * X.691, #10.6
-@@ -263,7 +356,59 @@
- 	return per_put_few_bits(po, n, 8 * bytes);
- }
- 
-+int
-+aper_put_nsnnwn(asn_per_outp_t *po, int range, int number) {
-+	int bytes;
- 
-+	/* 10.5.7.1 X.691 */
-+	if(range < 0) {
-+		int i;
-+		for (i = 1; ; i++) {
-+			int bits = 1 << (8 * i);
-+			if (number <= bits)
-+				break;
-+		}
-+		bytes = i;
-+		assert(i <= 4);
-+	}
-+	if(range <= 255) {
-+		int i;
-+		for (i = 1; i <= 8; i++) {
-+			int bits = 1 << i;
-+			if (range <= bits)
-+				break;
-+		}
-+		return per_put_few_bits(po, number, i);
-+	} else if(range == 256) {
-+		bytes = 1;
-+	} else if(range <= 65536) {
-+		bytes = 2;
-+	} else { /* Ranges > 64K */
-+		int i;
-+		for (i = 1; ; i++) {
-+			int bits = 1 << (8 * i);
-+			if (range <= bits)
-+				break;
-+		}
-+		assert(i <= 4);
-+		bytes = i;
-+	}
-+	if(aper_put_align(po) < 0) /* Aligning on octet */
-+		return -1;
-+
-+	return per_put_few_bits(po, number, 8 * bytes);
-+}
-+
-+int aper_put_align(asn_per_outp_t *po) {
-+
-+	if(po->nboff & 0x7) {
-+		ASN_DEBUG("Aligning %d bits", 8 - (po->nboff & 0x7));
-+		if(per_put_few_bits(po, 0x00, (8 - (po->nboff & 0x7))))
-+			return -1;
-+	}
-+	return 0;
-+}
-+
- /*
-  * Put a small number of bits (<= 31).
-  */
-@@ -392,6 +537,8 @@
- ssize_t
- uper_put_length(asn_per_outp_t *po, size_t length) {
- 
-+	ASN_DEBUG("UPER put length %d", length);
-+
- 	if(length <= 127)	/* #10.9.3.6 */
- 		return per_put_few_bits(po, length, 8)
- 			? -1 : (ssize_t)length;
-@@ -406,7 +553,34 @@
- 			? -1 : (ssize_t)(length << 14);
- }
- 
-+ssize_t
-+aper_put_length(asn_per_outp_t *po, int range, size_t length) {
- 
-+	ASN_DEBUG("APER put length %d with range %d", length, range);
-+
-+	/* 10.9 X.691 Note 2 */
-+	if (range <= 65536 && range >= 0)
-+		return aper_put_nsnnwn(po, range, length);
-+
-+	if (aper_put_align(po) < 0)
-+		return -1;
-+
-+	if(length <= 127)	   /* #10.9.3.6 */{
-+		return per_put_few_bits(po, length, 8)
-+		? -1 : (ssize_t)length;
-+	}
-+	else if(length < 16384) /* #10.9.3.7 */
-+		return per_put_few_bits(po, length|0x8000, 16)
-+		? -1 : (ssize_t)length;
-+	
-+	length >>= 14;
-+	if(length > 4) length = 4;
-+	
-+	return per_put_few_bits(po, 0xC0 | length, 8)
-+	? -1 : (ssize_t)(length << 14);
-+}
-+
-+
- /*
-  * Put the normally small length "n" into the stream.
-  * This procedure used to encode length of extensions bit-maps
-@@ -429,3 +603,19 @@
- 	return 0;
- }
- 
-+int
-+aper_put_nslength(asn_per_outp_t *po, size_t length) {
-+
-+	if(length <= 64) {
-+		/* #10.9.3.4 */
-+		if(length == 0) return -1;
-+		return per_put_few_bits(po, length-1, 7) ? -1 : 0;
-+	} else {
-+		if(aper_put_length(po, -1, length) != (ssize_t)length) {
-+			/* This might happen in case of >16K extensions */
-+			return -1;
-+		}
-+	}
-+
-+	return 0;
-+}
-Index: skeletons/constr_SET.c
-===================================================================
---- skeletons/constr_SET.c	(revision 1516)
-+++ skeletons/constr_SET.c	(working copy)
-@@ -36,7 +36,7 @@
- #undef	ADVANCE
- #define	ADVANCE(num_bytes)	do {		\
- 		size_t num = num_bytes;		\
--		ptr = ((const void *)ptr) + num;\
-+		ptr = ((const char *)ptr) + num;\
- 		size -= num;			\
- 		if(ctx->left >= 0)		\
- 			ctx->left -= num;	\
-@@ -132,7 +132,7 @@
- 	/*
- 	 * Restore parsing context.
- 	 */
--	ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset);
-+	ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
- 	
- 	/*
- 	 * Start to parse where left previously
-@@ -250,7 +250,7 @@
- 
- 			skip = ber_skip_length(opt_codec_ctx,
- 				BER_TLV_CONSTRUCTED(ptr),
--				(const void *)ptr + tag_len, LEFT - tag_len);
-+				(const char *)ptr + tag_len, LEFT - tag_len);
- 
- 			switch(skip) {
- 			case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE);
-@@ -271,7 +271,7 @@
- 		 * Check for duplications: must not overwrite
- 		 * already decoded elements.
- 		 */
--		if(ASN_SET_ISPRESENT2((void *)st + specs->pres_offset, edx)) {
-+		if(ASN_SET_ISPRESENT2((char *)st + specs->pres_offset, edx)) {
- 			ASN_DEBUG("SET %s: Duplicate element %s (%d)",
- 				td->name, elements[edx].name, edx);
- 			RETURN(RC_FAIL);
-@@ -284,13 +284,13 @@
- 		 */
- 		if(elements[edx].flags & ATF_POINTER) {
- 			/* Member is a pointer to another structure */
--			memb_ptr2 = (void **)((void *)st + elements[edx].memb_offset);
-+			memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset);
- 		} else {
- 			/*
- 			 * A pointer to a pointer
- 			 * holding the start of the structure
- 			 */
--			memb_ptr = (void *)st + elements[edx].memb_offset;
-+			memb_ptr = (char *)st + elements[edx].memb_offset;
- 			memb_ptr2 = &memb_ptr;
- 		}
- 		/*
-@@ -302,7 +302,7 @@
- 				elements[edx].tag_mode);
- 		switch(rval.code) {
- 		case RC_OK:
--			ASN_SET_MKPRESENT((void *)st + specs->pres_offset, edx);
-+			ASN_SET_MKPRESENT((char *)st + specs->pres_offset, edx);
- 			break;
- 		case RC_WMORE: /* More data expected */
- 			if(!SIZE_VIOLATION) {
-@@ -369,7 +369,7 @@
- 
- 			ll = ber_skip_length(opt_codec_ctx,
- 				BER_TLV_CONSTRUCTED(ptr),
--				(const void *)ptr + tl, LEFT - tl);
-+				(const char *)ptr + tl, LEFT - tl);
- 			switch(ll) {
- 			case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE);
- 				/* Fall through */
-@@ -404,7 +404,7 @@
- 		unsigned int midx, pres, must;
- 
- 		midx = edx/(8 * sizeof(specs->_mandatory_elements[0]));
--		pres = ((unsigned int *)((void *)st+specs->pres_offset))[midx];
-+		pres = ((unsigned int *)((char *)st+specs->pres_offset))[midx];
- 		must = sys_ntohl(specs->_mandatory_elements[midx]);
- 
- 		if((pres & must) == must) {
-@@ -473,7 +473,7 @@
- 		 * Compute the length of the encoding of this member.
- 		 */
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(void **)((void *)sptr + elm->memb_offset);
-+			memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
- 			if(!memb_ptr) {
- 				if(!elm->optional)
- 					/* Mandatory elements missing */
-@@ -486,7 +486,7 @@
- 				continue;
- 			}
- 		} else {
--			memb_ptr = (void *)((void *)sptr + elm->memb_offset);
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
- 		}
- 		tmper = elm->type->der_encoder(elm->type, memb_ptr,
- 			elm->tag_mode, elm->tag,
-@@ -547,10 +547,10 @@
- 		elm = &td->elements[t2m[edx].el_no];
- 
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(void **)((void *)sptr + elm->memb_offset);
-+			memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
- 			if(!memb_ptr) continue;
- 		} else {
--			memb_ptr = (void *)((void *)sptr + elm->memb_offset);
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
- 		}
- 		tmper = elm->type->der_encoder(elm->type, memb_ptr,
- 			elm->tag_mode, elm->tag,
-@@ -570,10 +570,185 @@
- 	_ASN_ENCODED_OK(er);
- }
- 
-+asn_enc_rval_t
-+SET_encode_uper(asn_TYPE_descriptor_t *td,
-+				asn_per_constraints_t *constraints,
-+				void *sptr,
-+				asn_per_outp_t *po) {
-+}
-+
-+asn_dec_rval_t
-+SET_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-+					 asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
-+}
-+
-+asn_enc_rval_t
-+SET_encode_aper(asn_TYPE_descriptor_t *td,
-+				asn_per_constraints_t *constraints,
-+				void *sptr,
-+				asn_per_outp_t *po) {
-+	asn_SET_specifics_t *specs = (asn_SET_specifics_t *)td->specifics;
-+	asn_enc_rval_t er;
-+	int edx, i;
-+	int t2m_build_own = (specs->tag2el_count != td->elements_count);
-+	asn_TYPE_tag2member_t *t2m;
-+	int t2m_count;
-+
-+	(void)constraints;
-+
-+	if(!sptr)
-+		_ASN_ENCODE_FAILED;
-+
-+	er.encoded = 0;
-+
-+	ASN_DEBUG("Encoding %s as SET (APER) map %d", td->name, specs->_mandatory_elements[0]);
-+
-+	/*
-+	 * Use existing, or build our own tags map.
-+	 */
-+	if(t2m_build_own) {
-+		t2m = (asn_TYPE_tag2member_t *)alloca(
-+			td->elements_count * sizeof(t2m[0]));
-+	if(!t2m) _ASN_ENCODE_FAILED; /* There are such platforms */
-+		t2m_count = 0;
-+	} else {
-+		/*
-+		 * There is no untagged CHOICE in this SET.
-+		 * Employ existing table.
-+		 */
-+		t2m = specs->tag2el;
-+		t2m_count = specs->tag2el_count;
-+	}
-+
-+	/*
-+	 * Gather the length of the underlying members sequence.
-+	 */
-+	for(edx = 0; edx < td->elements_count; edx++) {
-+		asn_TYPE_member_t *elm = &td->elements[edx];
-+		asn_enc_rval_t tmper;
-+		void *memb_ptr;
-+		
-+		/*
-+		 * Compute the length of the encoding of this member.
-+		 */
-+		if(elm->flags & ATF_POINTER) {
-+			memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
-+			if(!memb_ptr) {
-+				if(!elm->optional)
-+				/* Mandatory elements missing */
-+					_ASN_ENCODE_FAILED;
-+				if(t2m_build_own) {
-+					t2m[t2m_count].el_no = edx;
-+					t2m[t2m_count].el_tag = 0;
-+					t2m_count++;
-+				}
-+				continue;
-+			}
-+		} else {
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
-+		}
-+
-+		/*
-+		 * Remember the outmost tag of this member.
-+		 */
-+		if(t2m_build_own) {
-+			t2m[t2m_count].el_no = edx;
-+			t2m[t2m_count].el_tag = asn_TYPE_outmost_tag(
-+				elm->type, memb_ptr, elm->tag_mode, elm->tag);
-+			t2m_count++;
-+		} else {
-+			/*
-+			 * No dynamic sorting is necessary.
-+			 */
-+		}
-+	}
-+
-+	/*
-+	 * Finalize order of the components.
-+	 */
-+	assert(t2m_count == td->elements_count);
-+	if(t2m_build_own) {
-+		/*
-+		 * Sort the underlying members according to their
-+		 * canonical tags order. DER encoding mandates it.
-+		 */
-+		qsort(t2m, t2m_count, sizeof(specs->tag2el[0]), _t2e_cmp);
-+	} else {
-+		/*
-+		 * Tags are already sorted by the compiler.
-+		 */
-+	}
-+
-+	for(edx = 0; edx < td->elements_count; edx++) {
-+		asn_TYPE_member_t *elm = &td->elements[t2m[edx].el_no];
-+		asn_enc_rval_t tmper;
-+		void *memb_ptr;		 /* Pointer to the member */
-+		void **memb_ptr2;	   /* Pointer to that pointer */
-+		int present;
-+
-+		/* Fetch the pointer to this member */
-+		if(elm->flags & ATF_POINTER) {
-+			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
-+			present = (*memb_ptr2 != 0);
-+		} else {
-+//			 memb_ptr = (void *)((char *)sptr + elm->memb_offset);
-+//			 memb_ptr2 = &memb_ptr;
-+			present = 1;
-+			continue;
-+		}
-+
-+//		 /* Eliminate default values */
-+//		 if(present && elm->default_value
-+//			 && elm->default_value(0, memb_ptr2) == 1)
-+//			 present = 0;
-+
-+		ASN_DEBUG("Element %s %s %s->%s is %s",
-+				  elm->flags & ATF_POINTER ? "ptr" : "inline",
-+				  elm->default_value ? "def" : "wtv",
-+				  td->name, elm->name, present ? "present" : "absent");
-+		if(per_put_few_bits(po, present << 7, 8))
-+			_ASN_ENCODE_FAILED;
-+	}
-+
-+	/*
-+	 * Encode all members.
-+	 */
-+	for(edx = 0; edx < td->elements_count; edx++) {
-+		asn_TYPE_member_t *elm = &td->elements[edx];
-+		asn_enc_rval_t tmper;
-+		void *memb_ptr;		 /* Pointer to the member */
-+		void **memb_ptr2;	   /* Pointer to that pointer */
-+
-+		/* Encode according to the tag order */
-+//		 elm = &td->elements[t2m[edx].el_no];
-+
-+		if(elm->flags & ATF_POINTER) {
-+			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
-+			if(!*memb_ptr2) {
-+				ASN_DEBUG("Element %s %d not present",
-+						  elm->name, edx);
-+				if(elm->optional)
-+					continue;
-+				/* Mandatory element is missing */
-+				_ASN_ENCODE_FAILED;
-+			}
-+		} else {
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
-+			memb_ptr2 = &memb_ptr;
-+		}
-+		tmper = elm->type->aper_encoder(elm->type, elm->per_constraints,
-+										*memb_ptr2, po);
-+		if(tmper.encoded == -1)
-+			return tmper;
-+	}
-+
-+	_ASN_ENCODED_OK(er);
-+}
-+
- #undef	XER_ADVANCE
- #define	XER_ADVANCE(num_bytes)	do {			\
- 		size_t num = num_bytes;			\
--		buf_ptr = ((const void *)buf_ptr) + num;\
-+		buf_ptr = ((const char *)buf_ptr) + num;\
- 		size -= num;				\
- 		consumed_myself += num;			\
- 	} while(0)
-@@ -613,7 +788,7 @@
- 	/*
- 	 * Restore parsing context.
- 	 */
--	ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset);
-+	ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
- 
- 	/*
- 	 * Phases of XER/XML processing:
-@@ -637,7 +812,7 @@
- 			void *memb_ptr;		/* Pointer to the member */
- 			void **memb_ptr2;	/* Pointer to that pointer */
- 
--			if(ASN_SET_ISPRESENT2((void *)st + specs->pres_offset,
-+			if(ASN_SET_ISPRESENT2((char *)st + specs->pres_offset,
- 					edx)) {
- 				ASN_DEBUG("SET %s: Duplicate element %s (%d)",
- 				td->name, elements[edx].name, edx);
-@@ -648,10 +823,10 @@
- 
- 			if(elm->flags & ATF_POINTER) {
- 				/* Member is a pointer to another structure */
--				memb_ptr2 = (void **)((void *)st
-+				memb_ptr2 = (void **)((char *)st
- 					+ elm->memb_offset);
- 			} else {
--				memb_ptr = (void *)st + elm->memb_offset;
-+				memb_ptr = (char *)st + elm->memb_offset;
- 				memb_ptr2 = &memb_ptr;
- 			}
- 
-@@ -663,7 +838,7 @@
- 			if(tmprval.code != RC_OK)
- 				RETURN(tmprval.code);
- 			ctx->phase = 1;	/* Back to body processing */
--			ASN_SET_MKPRESENT((void *)st + specs->pres_offset, edx);
-+			ASN_SET_MKPRESENT((char *)st + specs->pres_offset, edx);
- 			ASN_DEBUG("XER/SET phase => %d", ctx->phase);
- 			/* Fall through */
- 		}
-@@ -827,7 +1002,7 @@
- 		mlen = strlen(elm->name);
- 
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(void **)((void *)sptr + elm->memb_offset);
-+			memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
- 			if(!memb_ptr) {
- 				if(elm->optional)
- 					continue;
-@@ -835,7 +1010,7 @@
- 				_ASN_ENCODE_FAILED;
- 			}
- 		} else {
--			memb_ptr = (void *)((void *)sptr + elm->memb_offset);
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
- 		}
- 
- 		if(!xcan)
-@@ -877,14 +1052,14 @@
- 		const void *memb_ptr;
- 
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(const void * const *)((const void *)sptr + elm->memb_offset);
-+			memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
- 			if(!memb_ptr) {
- 				if(elm->optional) continue;
- 				/* Print <absent> line */
- 				/* Fall through */
- 			}
- 		} else {
--			memb_ptr = (const void *)((const void *)sptr + elm->memb_offset);
-+			memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
- 		}
- 
- 		_i_INDENT(1);
-@@ -919,11 +1094,11 @@
- 		asn_TYPE_member_t *elm = &td->elements[edx];
- 		void *memb_ptr;
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(void **)((void *)ptr + elm->memb_offset);
-+			memb_ptr = *(void **)((char *)ptr + elm->memb_offset);
- 			if(memb_ptr)
- 				ASN_STRUCT_FREE(*elm->type, memb_ptr);
- 		} else {
--			memb_ptr = (void *)((void *)ptr + elm->memb_offset);
-+			memb_ptr = (void *)((char *)ptr + elm->memb_offset);
- 			ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr);
- 		}
- 	}
-@@ -953,7 +1128,7 @@
- 		const void *memb_ptr;
- 
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(const void * const *)((const void *)sptr + elm->memb_offset);
-+			memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
- 			if(!memb_ptr) {
- 				if(elm->optional)
- 					continue;
-@@ -963,7 +1138,7 @@
- 				return -1;
- 			}
- 		} else {
--			memb_ptr = (const void *)((const void *)sptr + elm->memb_offset);
-+			memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
- 		}
- 
- 		if(elm->memb_constraints) {
-Index: skeletons/constr_SEQUENCE_OF.c
-===================================================================
---- skeletons/constr_SEQUENCE_OF.c	(revision 1516)
-+++ skeletons/constr_SEQUENCE_OF.c	(working copy)
-@@ -164,7 +164,7 @@
- 	if(ct) {
- 		int not_in_root = (list->count < ct->lower_bound
- 				|| list->count > ct->upper_bound);
--		ASN_DEBUG("lb %ld ub %ld %s",
-+		ASN_DEBUG("lb %"PRIdMAX" ub %"PRIdMAX" %s",
- 			ct->lower_bound, ct->upper_bound,
- 			ct->flags & APC_EXTENSIBLE ? "ext" : "fix");
- 		if(ct->flags & APC_EXTENSIBLE) {
-@@ -206,3 +206,70 @@
- 	_ASN_ENCODED_OK(er);
- }
- 
-+asn_enc_rval_t
-+SEQUENCE_OF_encode_aper(asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-+	asn_anonymous_sequence_ *list;
-+	asn_per_constraint_t *ct;
-+	asn_enc_rval_t er;
-+	asn_TYPE_member_t *elm = td->elements;
-+	int seq;
-+
-+	if(!sptr) _ASN_ENCODE_FAILED;
-+	list = _A_SEQUENCE_FROM_VOID(sptr);
-+
-+	er.encoded = 0;
-+
-+	ASN_DEBUG("Encoding %s as SEQUENCE OF size (%d) using ALIGNED PER", td->name, list->count);
-+
-+	if(constraints) ct = &constraints->size;
-+	else if(td->per_constraints) ct = &td->per_constraints->size;
-+	else ct = 0;
-+
-+	/* If extensible constraint, check if size is in root */
-+	if(ct) {
-+		int not_in_root = (list->count < ct->lower_bound
-+				|| list->count > ct->upper_bound);
-+		ASN_DEBUG("lb %"PRIdMAX" ub %"PRIdMAX" %s",
-+			ct->lower_bound, ct->upper_bound,
-+			ct->flags & APC_EXTENSIBLE ? "ext" : "fix");
-+		if(ct->flags & APC_EXTENSIBLE) {
-+			/* Declare whether size is in extension root */
-+			if(per_put_few_bits(po, not_in_root, 1))
-+				_ASN_ENCODE_FAILED;
-+			if(not_in_root) ct = 0;
-+		} else if(not_in_root && ct->effective_bits >= 0)
-+			_ASN_ENCODE_FAILED;
-+	}
-+
-+	if(ct && ct->effective_bits >= 0) {
-+		/* X.691, #19.5: No length determinant */
-+//		 if(per_put_few_bits(po, list->count - ct->lower_bound,
-+//				 ct->effective_bits))
-+//			 _ASN_ENCODE_FAILED;
-+		if (aper_put_length(po, ct->upper_bound - ct->lower_bound + 1, list->count - ct->lower_bound) < 0)
-+			_ASN_ENCODE_FAILED;
-+	}
-+
-+	for(seq = -1; seq < list->count;) {
-+		ssize_t mayEncode;
-+		if(seq < 0) seq = 0;
-+		if(ct && ct->effective_bits >= 0) {
-+			mayEncode = list->count;
-+		} else {
-+			mayEncode = aper_put_length(po, -1, list->count - seq);
-+			if(mayEncode < 0) _ASN_ENCODE_FAILED;
-+		}
-+
-+		while(mayEncode--) {
-+			void *memb_ptr = list->array[seq++];
-+			if(!memb_ptr) _ASN_ENCODE_FAILED;
-+			er = elm->type->aper_encoder(elm->type,
-+				elm->per_constraints, memb_ptr, po);
-+			if(er.encoded == -1)
-+				_ASN_ENCODE_FAILED;
-+		}
-+	}
-+
-+	_ASN_ENCODED_OK(er);
-+}
-Index: skeletons/per_support.h
-===================================================================
---- skeletons/per_support.h	(revision 1516)
-+++ skeletons/per_support.h	(working copy)
-@@ -24,8 +24,8 @@
- 	} flags;
- 	int  range_bits;		/* Full number of bits in the range */
- 	int  effective_bits;		/* Effective bits */
--	long lower_bound;		/* "lb" value */
--	long upper_bound;		/* "ub" value */
-+	int64_t lower_bound;		/* "lb" value */
-+	int64_t upper_bound;		/* "ub" value */
- } asn_per_constraint_t;
- typedef struct asn_per_constraints_s {
- 	asn_per_constraint_t value;
-@@ -39,9 +39,9 @@
-  */
- typedef struct asn_per_data_s {
-   const uint8_t *buffer;  /* Pointer to the octet stream */
--         size_t  nboff;   /* Bit offset to the meaningful bit */
--         size_t  nbits;   /* Number of bits in the stream */
--         size_t  moved;   /* Number of bits moved through this bit stream */
-+		 size_t  nboff;   /* Bit offset to the meaningful bit */
-+		 size_t  nbits;   /* Number of bits in the stream */
-+		 size_t  moved;   /* Number of bits moved through this bit stream */
-   int (*refill)(struct asn_per_data_s *);
-   void *refill_key;
- } asn_per_data_t;
-@@ -71,15 +71,22 @@
- 			int effective_bound_bits,
- 			int *repeat);
- 
-+ssize_t aper_get_length(asn_per_data_t *pd,
-+						int range,
-+						int effective_bound_bits,
-+						int *repeat);
-+
- /*
-  * Get the normally small length "n".
-  */
- ssize_t uper_get_nslength(asn_per_data_t *pd);
-+ssize_t aper_get_nslength(asn_per_data_t *pd);
- 
- /*
-  * Get the normally small non-negative whole number.
-  */
- ssize_t uper_get_nsnnwn(asn_per_data_t *pd);
-+ssize_t aper_get_nsnnwn(asn_per_data_t *pd, int range);
- 
- /* Non-thread-safe debugging function, don't use it */
- char *per_data_string(asn_per_data_t *pd);
-@@ -103,6 +110,10 @@
- /* Output a large number of bits */
- int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits);
- 
-+/* Align the current bit position to octet bundary */
-+int aper_put_align(asn_per_outp_t *po);
-+int32_t aper_get_align(asn_per_data_t *pd);
-+
- /*
-  * Put the length "n" to the Unaligned PER stream.
-  * This function returns the number of units which may be flushed
-@@ -110,17 +121,23 @@
-  */
- ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length);
- 
-+ssize_t aper_put_length(asn_per_outp_t *po, int range, size_t length);
-+
- /*
-  * Put the normally small length "n" to the Unaligned PER stream.
-  * Returns 0 or -1.
-  */
- int uper_put_nslength(asn_per_outp_t *po, size_t length);
- 
-+int aper_put_nslength(asn_per_outp_t *po, size_t length);
-+
- /*
-  * Put the normally small non-negative whole number.
-  */
- int uper_put_nsnnwn(asn_per_outp_t *po, int n);
- 
-+int aper_put_nsnnwn(asn_per_outp_t *po, int range, int number);
-+
- #ifdef __cplusplus
- }
- #endif
-Index: skeletons/constr_SET.h
-===================================================================
---- skeletons/constr_SET.h	(revision 1516)
-+++ skeletons/constr_SET.h	(working copy)
-@@ -53,7 +53,9 @@
- xer_type_decoder_f SET_decode_xer;
- xer_type_encoder_f SET_encode_xer;
- per_type_decoder_f SET_decode_uper;
-+per_type_decoder_f SET_decode_aper;
- per_type_encoder_f SET_encode_uper;
-+per_type_encoder_f SET_encode_aper;
- 
- /***********************
-  * Some handy helpers. *
-Index: skeletons/constr_SEQUENCE_OF.h
-===================================================================
---- skeletons/constr_SEQUENCE_OF.h	(revision 1516)
-+++ skeletons/constr_SEQUENCE_OF.h	(working copy)
-@@ -22,9 +22,11 @@
- #define	SEQUENCE_OF_decode_ber	SET_OF_decode_ber
- #define	SEQUENCE_OF_decode_xer	SET_OF_decode_xer
- #define	SEQUENCE_OF_decode_uper	SET_OF_decode_uper
-+#define	SEQUENCE_OF_decode_aper	SET_OF_decode_aper
- der_type_encoder_f SEQUENCE_OF_encode_der;
- xer_type_encoder_f SEQUENCE_OF_encode_xer;
- per_type_encoder_f SEQUENCE_OF_encode_uper;
-+per_type_encoder_f SEQUENCE_OF_encode_aper;
- 
- #ifdef __cplusplus
- }
-Index: skeletons/ENUMERATED.c
-===================================================================
---- skeletons/ENUMERATED.c	(revision 1516)
-+++ skeletons/ENUMERATED.c	(working copy)
-@@ -26,6 +26,8 @@
- 	INTEGER_encode_xer,
- 	ENUMERATED_decode_uper,	/* Unaligned PER decoder */
- 	ENUMERATED_encode_uper,	/* Unaligned PER encoder */
-+	ENUMERATED_decode_aper,	/* Aligned PER decoder */
-+	ENUMERATED_encode_aper,	/* Aligned PER encoder */
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_ENUMERATED_tags,
- 	sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]),
-@@ -57,6 +59,27 @@
- 	return rval;
- }
- 
-+asn_dec_rval_t
-+ENUMERATED_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
-+	asn_dec_rval_t rval;
-+	ENUMERATED_t *st = (ENUMERATED_t *)*sptr;
-+	long value;
-+	void *vptr = &value;
-+
-+	if(!st) {
-+		st = (ENUMERATED_t *)(*sptr = CALLOC(1, sizeof(*st)));
-+		if(!st) _ASN_DECODE_FAILED;
-+	}
-+
-+	rval = NativeEnumerated_decode_aper(opt_codec_ctx, td, constraints,
-+			(void **)&vptr, pd);
-+	if(rval.code == RC_OK)
-+		if(asn_long2INTEGER(st, value))
-+			rval.code = RC_FAIL;
-+	return rval;
-+}
-+
- asn_enc_rval_t
- ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td,
- 	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-@@ -69,3 +92,14 @@
- 	return NativeEnumerated_encode_uper(td, constraints, &value, po);
- }
- 
-+asn_enc_rval_t
-+ENUMERATED_encode_aper(asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-+	ENUMERATED_t *st = (ENUMERATED_t *)sptr;
-+	long value;
-+	
-+	if(asn_INTEGER2long(st, &value))
-+		_ASN_ENCODE_FAILED;
-+	
-+	return NativeEnumerated_encode_aper(td, constraints, &value, po);
-+}
-Index: skeletons/ENUMERATED.h
-===================================================================
---- skeletons/ENUMERATED.h	(revision 1516)
-+++ skeletons/ENUMERATED.h	(working copy)
-@@ -17,6 +17,8 @@
- 
- per_type_decoder_f ENUMERATED_decode_uper;
- per_type_encoder_f ENUMERATED_encode_uper;
-+per_type_decoder_f ENUMERATED_decode_aper;
-+per_type_encoder_f ENUMERATED_encode_aper;
- 
- #ifdef __cplusplus
- }
-Index: skeletons/NativeEnumerated.c
-===================================================================
---- skeletons/NativeEnumerated.c	(revision 1516)
-+++ skeletons/NativeEnumerated.c	(working copy)
-@@ -30,6 +30,8 @@
- 	NativeEnumerated_encode_xer,
- 	NativeEnumerated_decode_uper,
- 	NativeEnumerated_encode_uper,
-+	NativeEnumerated_decode_aper,
-+	NativeEnumerated_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_NativeEnumerated_tags,
- 	sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]),
-@@ -42,17 +44,17 @@
- 
- asn_enc_rval_t
- NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
--        int ilevel, enum xer_encoder_flags_e flags,
--                asn_app_consume_bytes_f *cb, void *app_key) {
-+	int ilevel, enum xer_encoder_flags_e flags,
-+	asn_app_consume_bytes_f *cb, void *app_key) {
- 	asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
--        asn_enc_rval_t er;
--        const long *native = (const long *)sptr;
-+	asn_enc_rval_t er;
-+	const long *native = (const long *)sptr;
- 	const asn_INTEGER_enum_map_t *el;
- 
--        (void)ilevel;
--        (void)flags;
-+	(void)ilevel;
-+	(void)flags;
- 
--        if(!native) _ASN_ENCODE_FAILED;
-+	if(!native) _ASN_ENCODE_FAILED;
- 
- 	el = INTEGER_map_value2enum(specs, *native);
- 	if(el) {
-@@ -125,6 +127,66 @@
- 	return rval;
- }
- 
-+asn_dec_rval_t
-+NativeEnumerated_decode_aper(asn_codec_ctx_t *opt_codec_ctx,
-+	asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
-+	void **sptr, asn_per_data_t *pd) {
-+	asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics;
-+	asn_dec_rval_t rval = { RC_OK, 0 };
-+	long *native = (long *)*sptr;
-+	asn_per_constraint_t *ct;
-+	long value;
-+	int freeme = 0;
-+
-+	(void)opt_codec_ctx;
-+
-+	if(constraints) ct = &constraints->value;
-+	else if(td->per_constraints) ct = &td->per_constraints->value;
-+	else _ASN_DECODE_FAILED;	/* Mandatory! */
-+	if(!specs) _ASN_DECODE_FAILED;
-+
-+	if(!native) {
-+		native = (long *)(*sptr = CALLOC(1, sizeof(*native)));
-+		freeme = 1;
-+		if(!native) _ASN_DECODE_FAILED;
-+	}
-+
-+	ASN_DEBUG("Decoding %s as NativeEnumerated", td->name);
-+
-+	if(ct->flags & APC_EXTENSIBLE) {
-+		int inext = per_get_few_bits(pd, 1);
-+		if(inext < 0) _ASN_DECODE_STARVED;
-+		if(inext) ct = 0;
-+	}
-+
-+	if(ct && ct->range_bits >= 0) {
-+		value = per_get_few_bits(pd, ct->range_bits);
-+		if(value < 0) _ASN_DECODE_STARVED;
-+		if(value >= (specs->extension
-+			? specs->extension - 1 : specs->map_count))
-+			_ASN_DECODE_FAILED;
-+	} else {
-+		if(!specs->extension)
-+			_ASN_DECODE_FAILED;
-+		/*
-+		 * X.691, #10.6: normally small non-negative whole number;
-+		 */
-+		value = uper_get_nsnnwn(pd);
-+		if(value < 0) _ASN_DECODE_STARVED;
-+		value += specs->extension - 1;
-+		if(value >= specs->map_count)
-+			_ASN_DECODE_FAILED;
-+	}
-+
-+	*native = specs->value2enum[value].nat_value;
-+	ASN_DEBUG("Decoded %s = %ld", td->name, *native);
-+
-+	if (freeme)
-+		free(native);
-+
-+	return rval;
-+}
-+
- static int
- NativeEnumerated__compar_value2enum(const void *ap, const void *bp) {
- 	const asn_INTEGER_enum_map_t *a = ap;
-@@ -205,3 +267,71 @@
- 	_ASN_ENCODED_OK(er);
- }
- 
-+asn_enc_rval_t
-+NativeEnumerated_encode_aper(asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-+	asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics;
-+	asn_enc_rval_t er;
-+	long native, value;
-+	asn_per_constraint_t *ct;
-+	int inext = 0;
-+	asn_INTEGER_enum_map_t key;
-+	asn_INTEGER_enum_map_t *kf;
-+
-+	if(!sptr) _ASN_ENCODE_FAILED;
-+	if(!specs) _ASN_ENCODE_FAILED;
-+
-+	if(constraints) ct = &constraints->value;
-+	else if(td->per_constraints) ct = &td->per_constraints->value;
-+	else _ASN_ENCODE_FAILED;	/* Mandatory! */
-+
-+	ASN_DEBUG("Encoding %s as NativeEnumerated", td->name);
-+
-+	er.encoded = 0;
-+
-+	native = *(long *)sptr;
-+	if(native < 0) _ASN_ENCODE_FAILED;
-+
-+	key.nat_value = native;
-+	kf = bsearch(&key, specs->value2enum, specs->map_count,
-+		sizeof(key), NativeEnumerated__compar_value2enum);
-+	if(!kf) {
-+		ASN_DEBUG("No element corresponds to %ld", native);
-+		_ASN_ENCODE_FAILED;
-+	}
-+	value = kf - specs->value2enum;
-+
-+	if(ct->range_bits >= 0) {
-+		int cmpWith = specs->extension
-+				? specs->extension - 1 : specs->map_count;
-+		if(value >= cmpWith)
-+			inext = 1;
-+	}
-+	if(ct->flags & APC_EXTENSIBLE) {
-+		if(per_put_few_bits(po, inext, 1))
-+			_ASN_ENCODE_FAILED;
-+		if(inext) ct = 0;
-+	} else if(inext) {
-+		_ASN_ENCODE_FAILED;
-+	}
-+
-+	if(ct && ct->range_bits >= 0) {
-+		if(per_put_few_bits(po, value, ct->range_bits))
-+			_ASN_ENCODE_FAILED;
-+		_ASN_ENCODED_OK(er);
-+	}
-+
-+	if(!specs->extension)
-+		_ASN_ENCODE_FAILED;
-+
-+	/*
-+	 * X.691, #10.6: normally small non-negative whole number;
-+	 */
-+	ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld",
-+		value, specs->extension, inext,
-+		value - (inext ? (specs->extension - 1) : 0));
-+	if(uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0)))
-+		_ASN_ENCODE_FAILED;
-+
-+	_ASN_ENCODED_OK(er);
-+}
-Index: skeletons/GeneralString.c
-===================================================================
---- skeletons/GeneralString.c	(revision 1516)
-+++ skeletons/GeneralString.c	(working copy)
-@@ -24,6 +24,8 @@
- 	OCTET_STRING_encode_xer,
- 	OCTET_STRING_decode_uper,    /* Implemented in terms of OCTET STRING */
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_GeneralString_tags,
- 	sizeof(asn_DEF_GeneralString_tags)
-Index: skeletons/IA5String.c
-===================================================================
---- skeletons/IA5String.c	(revision 1516)
-+++ skeletons/IA5String.c	(working copy)
-@@ -29,6 +29,8 @@
- 	OCTET_STRING_encode_xer_utf8,
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_IA5String_tags,
- 	sizeof(asn_DEF_IA5String_tags)
-Index: skeletons/NativeEnumerated.h
-===================================================================
---- skeletons/NativeEnumerated.h	(revision 1516)
-+++ skeletons/NativeEnumerated.h	(working copy)
-@@ -24,6 +24,8 @@
- xer_type_encoder_f NativeEnumerated_encode_xer;
- per_type_decoder_f NativeEnumerated_decode_uper;
- per_type_encoder_f NativeEnumerated_encode_uper;
-+per_type_decoder_f NativeEnumerated_decode_aper;
-+per_type_encoder_f NativeEnumerated_encode_aper;
- 
- #ifdef __cplusplus
- }
-Index: skeletons/OBJECT_IDENTIFIER.c
-===================================================================
---- skeletons/OBJECT_IDENTIFIER.c	(revision 1516)
-+++ skeletons/OBJECT_IDENTIFIER.c	(working copy)
-@@ -27,6 +27,8 @@
- 	OBJECT_IDENTIFIER_encode_xer,
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_OBJECT_IDENTIFIER_tags,
- 	sizeof(asn_DEF_OBJECT_IDENTIFIER_tags)
-Index: skeletons/per_opentype.c
-===================================================================
---- skeletons/per_opentype.c	(revision 1516)
-+++ skeletons/per_opentype.c	(working copy)
-@@ -53,6 +53,35 @@
- 	return 0;
- }
- 
-+int
-+aper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-+	void *buf;
-+	void *bptr;
-+	ssize_t size;
-+	size_t toGo;
-+	
-+	ASN_DEBUG("Open type put %s ...", td->name);
-+	
-+	size = aper_encode_to_new_buffer(td, constraints, sptr, &buf);
-+	if(size <= 0) return -1;
-+
-+	for(bptr = buf, toGo = size; toGo;) {
-+		ssize_t maySave = aper_put_length(po, -1, toGo);
-+		if(maySave < 0) break;
-+		if(per_put_many_bits(po, bptr, maySave * 8)) break;
-+		bptr = (char *)bptr + maySave;
-+		toGo -= maySave;
-+	}
-+	
-+	FREEMEM(buf);
-+	if(toGo) return -1;
-+	
-+	ASN_DEBUG("Open type put %s of length %ld + overhead (1byte?)",
-+		td->name, (long)size);
-+	
-+	return 0;
-+}
-+
- static asn_dec_rval_t
- uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
- 	asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
-Index: skeletons/VideotexString.c
-===================================================================
---- skeletons/VideotexString.c	(revision 1516)
-+++ skeletons/VideotexString.c	(working copy)
-@@ -24,6 +24,8 @@
- 	OCTET_STRING_encode_xer,
- 	OCTET_STRING_decode_uper,    /* Implemented in terms of OCTET STRING */
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_VideotexString_tags,
- 	sizeof(asn_DEF_VideotexString_tags)
-Index: skeletons/per_opentype.h
-===================================================================
---- skeletons/per_opentype.h	(revision 1516)
-+++ skeletons/per_opentype.h	(working copy)
-@@ -15,6 +15,8 @@
- 
- int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po);
- 
-+int aper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po);
-+
- #ifdef __cplusplus
- }
- #endif
-Index: skeletons/BOOLEAN.c
-===================================================================
---- skeletons/BOOLEAN.c	(revision 1516)
-+++ skeletons/BOOLEAN.c	(working copy)
-@@ -24,6 +24,8 @@
- 	BOOLEAN_encode_xer,
- 	BOOLEAN_decode_uper,	/* Unaligned PER decoder */
- 	BOOLEAN_encode_uper,	/* Unaligned PER encoder */
-+	BOOLEAN_decode_aper,	/* Aligned PER decoder */
-+	BOOLEAN_encode_aper,	/* Aligned PER encoder */
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_BOOLEAN_tags,
- 	sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]),
-@@ -264,7 +266,36 @@
- 	return rv;
- }
- 
-+asn_dec_rval_t
-+BOOLEAN_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
-+	asn_dec_rval_t rv;
-+	BOOLEAN_t *st = (BOOLEAN_t *)*sptr;
- 
-+	(void)opt_codec_ctx;
-+	(void)constraints;
-+
-+	if(!st) {
-+		st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st)));
-+		if(!st) _ASN_DECODE_FAILED;
-+	}
-+
-+	/*
-+	 * Extract a single bit
-+	 */
-+	switch(per_get_few_bits(pd, 1)) {
-+	case 1: *st = 1; break;
-+	case 0: *st = 0; break;
-+	case -1: default: _ASN_DECODE_STARVED;
-+	}
-+
-+	ASN_DEBUG("%s decoded as %s", td->name, *st ? "TRUE" : "FALSE");
-+
-+	rv.code = RC_OK;
-+	rv.consumed = 1;
-+	return rv;
-+}
-+
- asn_enc_rval_t
- BOOLEAN_encode_uper(asn_TYPE_descriptor_t *td,
- 	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-@@ -280,3 +311,18 @@
- 
- 	_ASN_ENCODED_OK(er);
- }
-+
-+asn_enc_rval_t
-+BOOLEAN_encode_aper(asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-+	const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
-+	asn_enc_rval_t er;
-+
-+	(void)constraints;
-+
-+	if(!st) _ASN_ENCODE_FAILED;
-+
-+	per_put_few_bits(po, *st ? 1 : 0, 1);
-+
-+	_ASN_ENCODED_OK(er);
-+}
-Index: skeletons/ISO646String.c
-===================================================================
---- skeletons/ISO646String.c	(revision 1516)
-+++ skeletons/ISO646String.c	(working copy)
-@@ -29,6 +29,8 @@
- 	OCTET_STRING_encode_xer_utf8,
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_ISO646String_tags,
- 	sizeof(asn_DEF_ISO646String_tags)
-Index: skeletons/constr_CHOICE.c
-===================================================================
---- skeletons/constr_CHOICE.c	(revision 1516)
-+++ skeletons/constr_CHOICE.c	(working copy)
-@@ -34,7 +34,7 @@
- #undef	ADVANCE
- #define	ADVANCE(num_bytes)	do {		\
- 		size_t num = num_bytes;		\
--		ptr = ((const void *)ptr) + num;\
-+		ptr = ((const char *)ptr) + num;\
- 		size -= num;			\
- 		if(ctx->left >= 0)		\
- 			ctx->left -= num;	\
-@@ -133,7 +133,7 @@
- 	/*
- 	 * Restore parsing context.
- 	 */
--	ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset);
-+	ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
- 	
- 	/*
- 	 * Start to parse where left previously
-@@ -211,7 +211,7 @@
- 
- 				skip = ber_skip_length(opt_codec_ctx,
- 					BER_TLV_CONSTRUCTED(ptr),
--					(const void *)ptr + tag_len,
-+					(const char *)ptr + tag_len,
- 					LEFT - tag_len);
- 
- 				switch(skip) {
-@@ -244,7 +244,7 @@
- 		 */
- 		if(elm->flags & ATF_POINTER) {
- 			/* Member is a pointer to another structure */
--			memb_ptr2 = (void **)((void *)st + elm->memb_offset);
-+			memb_ptr2 = (void **)((char *)st + elm->memb_offset);
- 		} else {
- 			/*
- 			 * A pointer to a pointer
-@@ -390,7 +390,7 @@
- 	 */
- 	elm = &td->elements[present-1];
- 	if(elm->flags & ATF_POINTER) {
--		memb_ptr = *(void **)((void *)sptr + elm->memb_offset);
-+		memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
- 		if(memb_ptr == 0) {
- 			if(elm->optional) {
- 				erval.encoded = 0;
-@@ -400,7 +400,7 @@
- 			_ASN_ENCODE_FAILED;
- 		}
- 	} else {
--		memb_ptr = (void *)((void *)sptr + elm->memb_offset);
-+		memb_ptr = (void *)((char *)sptr + elm->memb_offset);
- 	}
- 
- 	/*
-@@ -463,10 +463,10 @@
- 
- 		if(elm->flags & ATF_POINTER) {
- 			memb_ptr = *(const void * const *)
--					((const void *)ptr + elm->memb_offset);
-+					((const char *)ptr + elm->memb_offset);
- 		} else {
- 			memb_ptr = (const void *)
--					((const void *)ptr + elm->memb_offset);
-+					((const char *)ptr + elm->memb_offset);
- 		}
- 
- 		return asn_TYPE_outmost_tag(elm->type, memb_ptr,
-@@ -498,7 +498,7 @@
- 		const void *memb_ptr;
- 
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(const void * const *)((const void *)sptr + elm->memb_offset);
-+			memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
- 			if(!memb_ptr) {
- 				if(elm->optional)
- 					return 0;
-@@ -508,7 +508,7 @@
- 				return -1;
- 			}
- 		} else {
--			memb_ptr = (const void *)((const void *)sptr + elm->memb_offset);
-+			memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
- 		}
- 
- 		if(elm->memb_constraints) {
-@@ -535,7 +535,7 @@
- #undef	XER_ADVANCE
- #define	XER_ADVANCE(num_bytes)	do {			\
- 		size_t num = num_bytes;			\
--		buf_ptr = ((const void *)buf_ptr) + num;\
-+		buf_ptr = ((const char *)buf_ptr) + num;\
- 		size -= num;				\
- 		consumed_myself += num;			\
- 	} while(0)
-@@ -574,7 +574,7 @@
- 	/*
- 	 * Restore parsing context.
- 	 */
--	ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset);
-+	ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
- 	if(ctx->phase == 0 && !*xml_tag)
- 		ctx->phase = 1;	/* Skip the outer tag checking phase */
- 
-@@ -605,7 +605,7 @@
- 
- 			if(elm->flags & ATF_POINTER) {
- 				/* Member is a pointer to another structure */
--				memb_ptr2 = (void **)((void *)st
-+				memb_ptr2 = (void **)((char *)st
- 					+ elm->memb_offset);
- 			} else {
- 				memb_ptr = (char *)st + elm->memb_offset;
-@@ -797,10 +797,10 @@
- 		unsigned int mlen = strlen(mname);
- 
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(void **)((void *)sptr + elm->memb_offset);
-+			memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
- 			if(!memb_ptr) _ASN_ENCODE_FAILED;
- 		} else {
--			memb_ptr = (void *)((void *)sptr + elm->memb_offset);
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
- 		}
- 
- 		er.encoded = 0;
-@@ -884,7 +884,7 @@
- 	elm = &td->elements[value];
- 	if(elm->flags & ATF_POINTER) {
- 		/* Member is a pointer to another structure */
--		memb_ptr2 = (void **)((void *)st + elm->memb_offset);
-+		memb_ptr2 = (void **)((char *)st + elm->memb_offset);
- 	} else {
- 		memb_ptr = (char *)st + elm->memb_offset;
- 		memb_ptr2 = &memb_ptr;
-@@ -904,7 +904,88 @@
- 			elm->name, td->name, rv.code);
- 	return rv;
- }
--   
-+
-+asn_dec_rval_t
-+CHOICE_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
-+	asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics;
-+	asn_dec_rval_t rv;
-+	asn_per_constraint_t *ct;
-+	asn_TYPE_member_t *elm;	/* CHOICE's element */
-+	void *memb_ptr;
-+	void **memb_ptr2;
-+	void *st = *sptr;
-+	int value;
-+
-+	if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx))
-+		_ASN_DECODE_FAILED;
-+
-+	/*
-+	 * Create the target structure if it is not present already.
-+	 */
-+	if(!st) {
-+		st = *sptr = CALLOC(1, specs->struct_size);
-+		if(!st) _ASN_DECODE_FAILED;
-+	}
-+
-+	if(constraints) ct = &constraints->value;
-+	else if(td->per_constraints) ct = &td->per_constraints->value;
-+	else ct = 0;
-+
-+	if(ct && ct->flags & APC_EXTENSIBLE) {
-+		value = per_get_few_bits(pd, 1);
-+		if(value < 0) _ASN_DECODE_STARVED;
-+		if(value) ct = 0;	/* Not restricted */
-+	}
-+
-+	if(ct && ct->range_bits >= 0) {
-+		value = per_get_few_bits(pd, ct->range_bits);
-+		if(value < 0) _ASN_DECODE_STARVED;
-+		ASN_DEBUG("CHOICE %s got index %d in range %d",
-+			td->name, value, ct->range_bits);
-+		if(value > ct->upper_bound)
-+			_ASN_DECODE_FAILED;
-+	} else {
-+		if(specs->ext_start == -1)
-+			_ASN_DECODE_FAILED;
-+		value = uper_get_nsnnwn(pd);
-+		if(value < 0) _ASN_DECODE_STARVED;
-+		value += specs->ext_start;
-+		if(value >= td->elements_count)
-+			_ASN_DECODE_FAILED;
-+	}
-+
-+	/* Adjust if canonical order is different from natural order */
-+	if(specs->canonical_order)
-+		value = specs->canonical_order[value];
-+
-+	/* Set presence to be able to free it later */
-+	_set_present_idx(st, specs->pres_offset, specs->pres_size, value + 1);
-+
-+	elm = &td->elements[value];
-+	if(elm->flags & ATF_POINTER) {
-+		/* Member is a pointer to another structure */
-+		memb_ptr2 = (void **)((char *)st + elm->memb_offset);
-+	} else {
-+		memb_ptr = (char *)st + elm->memb_offset;
-+		memb_ptr2 = &memb_ptr;
-+	}
-+	ASN_DEBUG("Discovered CHOICE %s encodes %s", td->name, elm->name);
-+
-+	if(ct && ct->range_bits >= 0) {
-+		rv = elm->type->aper_decoder(opt_codec_ctx, elm->type,
-+			elm->per_constraints, memb_ptr2, pd);
-+	} else {
-+		rv = uper_open_type_get(opt_codec_ctx, elm->type,
-+			elm->per_constraints, memb_ptr2, pd);
-+	}
-+
-+	if(rv.code != RC_OK)
-+		ASN_DEBUG("Failed to decode %s in %s (CHOICE) %d",
-+			elm->name, td->name, rv.code);
-+	return rv;
-+}
-+
- asn_enc_rval_t
- CHOICE_encode_uper(asn_TYPE_descriptor_t *td,
- 	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-@@ -917,7 +998,7 @@
- 
- 	if(!sptr) _ASN_ENCODE_FAILED;
- 
--	ASN_DEBUG("Encoding %s as CHOICE", td->name);
-+	ASN_DEBUG("Encoding %s as CHOICE using UPER", td->name);
- 
- 	if(constraints) ct = &constraints->value;
- 	else if(td->per_constraints) ct = &td->per_constraints->value;
-@@ -962,7 +1043,7 @@
- 	elm = &td->elements[present];
- 	if(elm->flags & ATF_POINTER) {
- 		/* Member is a pointer to another structure */
--		memb_ptr = *(void **)((void *)sptr + elm->memb_offset);
-+		memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
- 		if(!memb_ptr) _ASN_ENCODE_FAILED;
- 	} else {
- 		memb_ptr = (char *)sptr + elm->memb_offset;
-@@ -987,8 +1068,88 @@
- 		_ASN_ENCODED_OK(rval);
- 	}
- }
--   
- 
-+asn_enc_rval_t
-+CHOICE_encode_aper(asn_TYPE_descriptor_t *td,
-+				   asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-+	asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics;
-+	asn_TYPE_member_t *elm; /* CHOICE's element */
-+	asn_per_constraint_t *ct;
-+	void *memb_ptr;
-+	int present;
-+
-+	if(!sptr) _ASN_ENCODE_FAILED;
-+
-+	ASN_DEBUG("Encoding %s as CHOICE using ALIGNED PER", td->name);
-+
-+	if(constraints) ct = &constraints->value;
-+	else if(td->per_constraints) ct = &td->per_constraints->value;
-+	else ct = 0;
-+	
-+	present = _fetch_present_idx(sptr,
-+								 specs->pres_offset, specs->pres_size);
-+
-+	/*
-+	 * If the structure was not initialized properly, it cannot be encoded:
-+	 * can't deduce what to encode in the choice type.
-+	 */
-+	if(present <= 0 || present > td->elements_count)
-+		_ASN_ENCODE_FAILED;
-+	else
-+		present--;
-+
-+	/* Adjust if canonical order is different from natural order */
-+	if(specs->canonical_order)
-+		present = specs->canonical_order[present];
-+
-+	ASN_DEBUG("Encoding %s CHOICE element %d", td->name, present);
-+
-+	if(ct && ct->range_bits >= 0) {
-+		if(present < ct->lower_bound
-+			|| present > ct->upper_bound) {
-+			if(ct->flags & APC_EXTENSIBLE) {
-+				if(per_put_few_bits(po, 1, 1))
-+					_ASN_ENCODE_FAILED;
-+			} else {
-+				_ASN_ENCODE_FAILED;
-+			}
-+			ct = 0;
-+			}
-+	}
-+	if(ct && ct->flags & APC_EXTENSIBLE) {
-+		if(per_put_few_bits(po, 0, 1))
-+			_ASN_ENCODE_FAILED;
-+	}
-+
-+	elm = &td->elements[present];
-+	if(elm->flags & ATF_POINTER) {
-+		/* Member is a pointer to another structure */
-+		memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
-+		if(!memb_ptr) _ASN_ENCODE_FAILED;
-+	} else {
-+		memb_ptr = (char *)sptr + elm->memb_offset;
-+	}
-+
-+	if(ct && ct->range_bits >= 0) {
-+		if(per_put_few_bits(po, present, ct->range_bits))
-+			_ASN_ENCODE_FAILED;
-+
-+			return elm->type->aper_encoder(elm->type, elm->per_constraints,
-+										   memb_ptr, po);
-+	} else {
-+		asn_enc_rval_t rval;
-+		if(specs->ext_start == -1)
-+			_ASN_ENCODE_FAILED;
-+        if(aper_put_nsnnwn(po, ct->range_bits, present - specs->ext_start))
-+			_ASN_ENCODE_FAILED;
-+		if(aper_open_type_put(elm->type, elm->per_constraints,
-+			memb_ptr, po))
-+			_ASN_ENCODE_FAILED;
-+		rval.encoded = 0;
-+		_ASN_ENCODED_OK(rval);
-+	}
-+}
-+
- int
- CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
- 		asn_app_consume_bytes_f *cb, void *app_key) {
-@@ -1010,10 +1171,10 @@
- 		const void *memb_ptr;
- 
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(const void * const *)((const void *)sptr + elm->memb_offset);
-+			memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
- 			if(!memb_ptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
- 		} else {
--			memb_ptr = (const void *)((const void *)sptr + elm->memb_offset);
-+			memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
- 		}
- 
- 		/* Print member's name and stuff */
-@@ -1053,11 +1214,11 @@
- 		void *memb_ptr;
- 
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(void **)((void *)ptr + elm->memb_offset);
-+			memb_ptr = *(void **)((char *)ptr + elm->memb_offset);
- 			if(memb_ptr)
- 				ASN_STRUCT_FREE(*elm->type, memb_ptr);
- 		} else {
--			memb_ptr = (void *)((void *)ptr + elm->memb_offset);
-+			memb_ptr = (void *)((char *)ptr + elm->memb_offset);
- 			ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr);
- 		}
- 	}
-@@ -1082,7 +1243,7 @@
- 	const void *present_ptr;
- 	int present;
- 
--	present_ptr = ((const void *)struct_ptr) + pres_offset;
-+	present_ptr = ((const char *)struct_ptr) + pres_offset;
- 
- 	switch(pres_size) {
- 	case sizeof(int):	present =   *(const int *)present_ptr; break;
-@@ -1100,7 +1261,7 @@
- static void
- _set_present_idx(void *struct_ptr, int pres_offset, int pres_size, int present) {
- 	void *present_ptr;
--	present_ptr = ((void *)struct_ptr) + pres_offset;
-+	present_ptr = ((char *)struct_ptr) + pres_offset;
- 
- 	switch(pres_size) {
- 	case sizeof(int):	*(int *)present_ptr   = present; break;
-Index: skeletons/asn_internal.h
-===================================================================
---- skeletons/asn_internal.h	(revision 1516)
-+++ skeletons/asn_internal.h	(working copy)
-@@ -20,7 +20,7 @@
- #endif
- 
- /* Environment version might be used to avoid running with the old library */
--#define	ASN1C_ENVIRONMENT_VERSION	923	/* Compile-time version */
-+#define	ASN1C_ENVIRONMENT_VERSION	924	/* Compile-time version */
- int get_asn1c_environment_version(void);	/* Run-time version */
- 
- #define	CALLOC(nmemb, size)	calloc(nmemb, size)
-@@ -48,18 +48,22 @@
- #define ASN_DEBUG_INDENT_ADD(i) do { asn_debug_indent += i; } while(0)
- #endif	/* ASN_THREAD_SAFE */
- #define	ASN_DEBUG(fmt, args...)	do {			\
--		int adi = asn_debug_indent;		\
--		while(adi--) fprintf(stderr, " ");	\
--		fprintf(stderr, fmt, ##args);		\
--		fprintf(stderr, " (%s:%d)\n",		\
--			__FILE__, __LINE__);		\
--	} while(0)
-+	int adi = asn_debug_indent;			\
-+	while(adi--) fprintf(stderr, " ");	\
-+	fprintf(stderr, fmt, ##args);		\
-+	fprintf(stderr, " (%s:%d)\n",		\
-+		__FILE__, __LINE__);				\
-+} while(0)
- #else	/* !__GNUC__ */
- void ASN_DEBUG_f(const char *fmt, ...);
- #define	ASN_DEBUG	ASN_DEBUG_f
- #endif	/* __GNUC__ */
- #else	/* EMIT_ASN_DEBUG != 1 */
-+# ifdef EMIT_ASN_DEBUG_EXTERN
-+extern inline void ASN_DEBUG(const char *fmt, ...);
-+# else
- static inline void ASN_DEBUG(const char *fmt, ...) { (void)fmt; }
-+# endif
- #endif	/* EMIT_ASN_DEBUG */
- #endif	/* ASN_DEBUG */
- 
-Index: skeletons/BOOLEAN.h
-===================================================================
---- skeletons/BOOLEAN.h	(revision 1516)
-+++ skeletons/BOOLEAN.h	(working copy)
-@@ -28,6 +28,8 @@
- xer_type_encoder_f BOOLEAN_encode_xer;
- per_type_decoder_f BOOLEAN_decode_uper;
- per_type_encoder_f BOOLEAN_encode_uper;
-+per_type_decoder_f BOOLEAN_decode_aper;
-+per_type_encoder_f BOOLEAN_encode_aper;
- 
- #ifdef __cplusplus
- }
-Index: skeletons/constr_CHOICE.h
-===================================================================
---- skeletons/constr_CHOICE.h	(revision 1516)
-+++ skeletons/constr_CHOICE.h	(working copy)
-@@ -48,6 +48,8 @@
- xer_type_encoder_f CHOICE_encode_xer;
- per_type_decoder_f CHOICE_decode_uper;
- per_type_encoder_f CHOICE_encode_uper;
-+per_type_decoder_f CHOICE_decode_aper;
-+per_type_encoder_f CHOICE_encode_aper;
- asn_outmost_tag_f CHOICE_outmost_tag;
- 
- #ifdef __cplusplus
-Index: skeletons/INTEGER.c
-===================================================================
---- skeletons/INTEGER.c	(revision 1516)
-+++ skeletons/INTEGER.c	(working copy)
-@@ -27,9 +27,13 @@
- #ifdef	ASN_DISABLE_PER_SUPPORT
- 	0,
- 	0,
-+	0,
-+	0,
- #else
- 	INTEGER_decode_uper,	/* Unaligned PER decoder */
- 	INTEGER_encode_uper,	/* Unaligned PER encoder */
-+	INTEGER_decode_aper,
-+	INTEGER_encode_aper,
- #endif	/* ASN_DISABLE_PER_SUPPORT */
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_INTEGER_tags,
-@@ -612,7 +616,7 @@
- 				value = per_get_few_bits(pd, ct->range_bits);
- 				if(value < 0) _ASN_DECODE_STARVED;
- 			}
--			ASN_DEBUG("Got value %ld + low %ld",
-+			ASN_DEBUG("Got value %ld + low %"PRIdMAX,
- 				value, ct->lower_bound);
- 			value += ct->lower_bound;
- 			if((specs && specs->field_unsigned)
-@@ -660,6 +664,158 @@
- 	return rval;
- }
- 
-+asn_dec_rval_t
-+INTEGER_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
-+	asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
-+	asn_dec_rval_t rval = { RC_OK, 0 };
-+	INTEGER_t *st = (INTEGER_t *)*sptr;
-+	asn_per_constraint_t *ct;
-+	int repeat;
-+
-+	(void)opt_codec_ctx;
-+
-+	if(!st) {
-+		st = (INTEGER_t *)(*sptr = CALLOC(1, sizeof(*st)));
-+		if(!st) _ASN_DECODE_FAILED;
-+	}
-+
-+	if(!constraints) constraints = td->per_constraints;
-+	ct = constraints ? &constraints->value : 0;
-+
-+	if(ct && ct->flags & APC_EXTENSIBLE) {
-+		int inext = per_get_few_bits(pd, 1);
-+		if(inext < 0) _ASN_DECODE_STARVED;
-+		if(inext) ct = 0;
-+	}
-+
-+	FREEMEM(st->buf);
-+	st->buf = 0;
-+	st->size = 0;
-+	if(ct) {
-+		if(ct->flags & APC_SEMI_CONSTRAINED) {
-+			st->buf = (uint8_t *)CALLOC(1, 2);
-+			if(!st->buf) _ASN_DECODE_FAILED;
-+			st->size = 1;
-+		} else if(ct->flags & APC_CONSTRAINED && ct->range_bits >= 0) {
-+			size_t size = (ct->range_bits + 7) >> 3;
-+			st->buf = (uint8_t *)MALLOC(1 + size + 1);
-+			if(!st->buf) _ASN_DECODE_FAILED;
-+			st->size = size;
-+		}
-+	}
-+
-+	/* X.691, #12.2.2 */
-+	if(ct && ct->flags != APC_UNCONSTRAINED) {
-+		/* #10.5.6 */
-+		ASN_DEBUG("Integer with range %d bits", ct->range_bits);
-+		if(ct->range_bits >= 0) {
-+			if (ct->range_bits > 16) {
-+				int max_range_bytes = (ct->range_bits >> 3) +
-+					(((ct->range_bits % 8) > 0) ? 1 : 0);
-+				int length = 0, i;
-+				int64_t value = 0;
-+
-+				for (i = 1; ; i++) {
-+					int upper = 1 << i;
-+					if (upper >= max_range_bytes)
-+						break;
-+				}
-+				ASN_DEBUG("Can encode %d (%d bytes) in %d bits", ct->range_bits,
-+						  max_range_bytes, i);
-+
-+				if ((length = per_get_few_bits(pd, i)) < 0)
-+					_ASN_DECODE_FAILED;
-+
-+				/* X.691 #12.2.6 length determinant + lb (1) */
-+				length += 1;
-+				ASN_DEBUG("Got length %d", length);
-+
-+				if (aper_get_align(pd) != 0)
-+					_ASN_DECODE_STARVED;
-+
-+				while (length--) {
-+					int buf = per_get_few_bits(pd, 8);
-+					if (buf < 0)
-+						_ASN_DECODE_STARVED;
-+					value += (((int64_t)buf) << (8 * length));
-+				}
-+
-+				value += ct->lower_bound;
-+				if((specs && specs->field_unsigned)
-+					? asn_uint642INTEGER(st, value)
-+					: asn_int642INTEGER(st, value))
-+					_ASN_DECODE_FAILED;
-+				ASN_DEBUG("Got value %lld + low %lld",
-+						  value, ct->lower_bound);
-+			} else {
-+				long value = 0;
-+				if (ct->range_bits < 8) {
-+					value = per_get_few_bits(pd, ct->range_bits);
-+					if(value < 0) _ASN_DECODE_STARVED;
-+				} else if (ct->range_bits == 8) {
-+					if (aper_get_align(pd) < 0)
-+						_ASN_DECODE_FAILED;
-+					value = per_get_few_bits(pd, ct->range_bits);
-+					if(value < 0) _ASN_DECODE_STARVED;
-+				} else {
-+					/* Align */
-+					if (aper_get_align(pd) < 0)
-+						_ASN_DECODE_FAILED;
-+					value = per_get_few_bits(pd, 16);
-+					if(value < 0) _ASN_DECODE_STARVED;
-+				}
-+				value += ct->lower_bound;
-+				if((specs && specs->field_unsigned)
-+					? asn_ulong2INTEGER(st, value)
-+					: asn_long2INTEGER(st, value))
-+					_ASN_DECODE_FAILED;
-+					ASN_DEBUG("Got value %ld + low %lld",
-+							  value, ct->lower_bound);
-+			}
-+			return rval;
-+		} else {
-+			_ASN_DECODE_FAILED;
-+		}
-+	} else {
-+		ASN_DEBUG("Decoding unconstrained integer %s", td->name);
-+	}
-+
-+	/* X.691, #12.2.3, #12.2.4 */
-+	do {
-+		ssize_t len;
-+		void *p;
-+		int ret;
-+
-+		/* Get the PER length */
-+		len = aper_get_length(pd, -1, -1, &repeat);
-+		if(len < 0) _ASN_DECODE_STARVED;
-+
-+		p = REALLOC(st->buf, st->size + len + 1);
-+		if(!p) _ASN_DECODE_FAILED;
-+		st->buf = (uint8_t *)p;
-+
-+		ret = per_get_many_bits(pd, &st->buf[st->size], 0, 8 * len);
-+		if(ret < 0) _ASN_DECODE_STARVED;
-+		st->size += len;
-+	} while(repeat);
-+	st->buf[st->size] = 0;	/* JIC */
-+
-+	/* #12.2.3 */
-+	if(ct && ct->lower_bound) {
-+		/*
-+		 * TODO: replace by in-place arithmetics.
-+		 */
-+		long value;
-+		if(asn_INTEGER2long(st, &value))
-+			_ASN_DECODE_FAILED;
-+		if(asn_long2INTEGER(st, value + ct->lower_bound))
-+			_ASN_DECODE_FAILED;
-+	}
-+
-+	return rval;
-+}
-+
- asn_enc_rval_t
- INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
- 	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-@@ -693,7 +849,7 @@
- 				|| uval > (unsigned long)ct->upper_bound)
- 					inext = 1;
- 			}
--			ASN_DEBUG("Value %lu (%02x/%d) lb %lu ub %lu %s",
-+			ASN_DEBUG("Value %lu (%02x/%d) lb %"PRIuMAX" ub %"PRIuMAX" %s",
- 				uval, st->buf[0], st->size,
- 				ct->lower_bound, ct->upper_bound,
- 				inext ? "ext" : "fix");
-@@ -710,7 +866,7 @@
- 				|| value > ct->upper_bound)
- 					inext = 1;
- 			}
--			ASN_DEBUG("Value %ld (%02x/%d) lb %ld ub %ld %s",
-+			ASN_DEBUG("Value %ld (%02x/%d) lb %"PRIdMAX" ub %"PRIdMAX" %s",
- 				value, st->buf[0], st->size,
- 				ct->lower_bound, ct->upper_bound,
- 				inext ? "ext" : "fix");
-@@ -745,7 +901,7 @@
- 	}
- 
- 	if(ct && ct->lower_bound) {
--		ASN_DEBUG("Adjust lower bound to %ld", ct->lower_bound);
-+		ASN_DEBUG("Adjust lower bound to %"PRIdMAX"\n", ct->lower_bound);
- 		/* TODO: adjust lower bound */
- 		_ASN_ENCODE_FAILED;
- 	}
-@@ -762,6 +918,153 @@
- 	_ASN_ENCODED_OK(er);
- }
- 
-+asn_enc_rval_t
-+INTEGER_encode_aper(asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-+	asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
-+	asn_enc_rval_t er;
-+	INTEGER_t *st = (INTEGER_t *)sptr;
-+	const uint8_t *buf;
-+	const uint8_t *end;
-+	asn_per_constraint_t *ct;
-+	int64_t value = 0;
-+
-+	if(!st || st->size == 0) _ASN_ENCODE_FAILED;
-+
-+	if(!constraints) constraints = td->per_constraints;
-+	ct = constraints ? &constraints->value : 0;
-+
-+	er.encoded = 0;
-+
-+	if(ct) {
-+		int inext = 0;
-+		if(specs && specs->field_unsigned) {
-+			uint64_t uval;
-+			if(asn_INTEGER2uint64(st, &uval))
-+				_ASN_ENCODE_FAILED;
-+			/* Check proper range */
-+			if(ct->flags & APC_SEMI_CONSTRAINED) {
-+				if(uval < ct->lower_bound)
-+					inext = 1;
-+			} else if(ct->range_bits >= 0) {
-+				if(uval < ct->lower_bound
-+					|| uval > ct->upper_bound)
-+					inext = 1;
-+			}
-+			ASN_DEBUG("Value %llu (%02x/%d) lb %llu ub %llu %s",
-+								uval, st->buf[0], st->size,
-+								ct->lower_bound, ct->upper_bound,
-+								inext ? "ext" : "fix");
-+						value = uval;
-+		} else {
-+			if(asn_INTEGER2int64(st, &value)) _ASN_ENCODE_FAILED;
-+			/* Check proper range */
-+			if(ct->flags & APC_SEMI_CONSTRAINED) {
-+				if(value < ct->lower_bound)
-+					inext = 1;
-+			} else if(ct->range_bits >= 0) {
-+				if(value < ct->lower_bound
-+					|| value > ct->upper_bound)
-+					inext = 1;
-+			}
-+			ASN_DEBUG("Value %lld (%02x/%d) lb %lld ub %lld %s",
-+					  value, st->buf[0], st->size,
-+					  ct->lower_bound, ct->upper_bound,
-+					  inext ? "ext" : "fix");
-+		}
-+		if(ct->flags & APC_EXTENSIBLE) {
-+			if(per_put_few_bits(po, inext, 1))
-+				_ASN_ENCODE_FAILED;
-+			if(inext) ct = 0;
-+		} else if(inext) {
-+			_ASN_ENCODE_FAILED;
-+		}
-+	}
-+
-+	/* X.691, #12.2.2 */
-+	if(ct && ct->range_bits >= 0) {
-+		/* #10.5.6 */
-+		ASN_DEBUG("Encoding integer with range %d bits",
-+				  ct->range_bits);
-+		
-+		value -= ct->lower_bound;
-+		
-+		/* #12 <= 8 -> alignment ? */
-+		if (ct->range_bits < 8) {
-+			/* Bit field case -> no alignment*/
-+			if(per_put_few_bits(po, 0x00 | value, ct->range_bits))
-+				_ASN_ENCODE_FAILED;
-+		} else if (ct->range_bits == 8) {
-+			if(aper_put_align(po) < 0)
-+				_ASN_ENCODE_FAILED;
-+			if(per_put_few_bits(po, 0x00 | value, ct->range_bits))
-+				_ASN_ENCODE_FAILED;
-+		} else if (ct->range_bits <= 16) {
-+			// Consume the bytes to align on octet
-+			if(aper_put_align(po) < 0)
-+				_ASN_ENCODE_FAILED;
-+			if(per_put_few_bits(po, 0x0000 | value,
-+				16))
-+				_ASN_ENCODE_FAILED;
-+		} else {
-+			/* TODO: extend to >64 bits */
-+			int64_t v = value;
-+			int i, j;
-+			int max_range_bytes = (ct->range_bits >> 3) +
-+			(((ct->range_bits % 8) > 0) ? 1 : 0);
-+
-+			for (i = 1; ; i++) {
-+				int upper = 1 << i;
-+				if (upper >= max_range_bytes)
-+					break;
-+			}
-+
-+			for(j = sizeof(int64_t) - 1; j != 0; j--) {
-+				uint8_t val;
-+				val = v >> (j * 8);
-+				if (val != 0) {
-+					break;
-+				}
-+			}
-+
-+			ASN_DEBUG("Putting n - lb (%"PRIdMAX") with range %d bytes (real size - lb (1)) %d in %d bits",
-+					  v, max_range_bytes, j, i);
-+
-+			/* Putting length in the minimum number of bits ex: 5 = 3bits */
-+			if (per_put_few_bits(po, j, i))
-+				_ASN_ENCODE_FAILED;
-+
-+			// Consume the bits to align on octet
-+			if (aper_put_align(po) < 0)
-+				_ASN_ENCODE_FAILED;
-+
-+			/* Put the value */
-+			for (i = 0; i <= j; i++) {
-+				if(per_put_few_bits(po, (v >> (8 * (j - i))) & 0xff, 8))
-+					_ASN_ENCODE_FAILED;
-+			}
-+		}
-+		_ASN_ENCODED_OK(er);
-+	}
-+
-+	if(ct && ct->lower_bound) {
-+		ASN_DEBUG("Adjust lower bound to %"PRIdMAX, ct->lower_bound);
-+		/* TODO: adjust lower bound */
-+		_ASN_ENCODE_FAILED;
-+	}
-+
-+	for(buf = st->buf, end = st->buf + st->size; buf < end;) {
-+		ssize_t mayEncode = aper_put_length(po, -1, end - buf);
-+		if(mayEncode < 0)
-+			_ASN_ENCODE_FAILED;
-+		if(per_put_many_bits(po, buf, 8 * mayEncode))
-+			_ASN_ENCODE_FAILED;
-+		buf += mayEncode;
-+	}
-+	
-+	_ASN_ENCODED_OK(er);
-+}
-+
- #endif	/* ASN_DISABLE_PER_SUPPORT */
- 
- int
-@@ -825,6 +1128,66 @@
- }
- 
- int
-+asn_INTEGER2int64(const INTEGER_t *iptr, int64_t *lptr) {
-+	uint8_t *b, *end;
-+	size_t size;
-+	int64_t l;
-+	
-+	/* Sanity checking */
-+	if(!iptr || !iptr->buf || !lptr) {
-+		errno = EINVAL;
-+		return -1;
-+	}
-+	
-+	/* Cache the begin/end of the buffer */
-+	b = iptr->buf;	/* Start of the INTEGER buffer */
-+	size = iptr->size;
-+	end = b + size;	/* Where to stop */
-+	
-+	if(size > sizeof(int64_t)) {
-+		uint8_t *end1 = end - 1;
-+		/*
-+		 * Slightly more advanced processing,
-+		 * able to >sizeof(int64_t) bytes,
-+		 * when the actual value is small
-+		 * (0x0000000000abcdef would yield a fine 0x00abcdef)
-+		 */
-+		/* Skip out the insignificant leading bytes */
-+		for(; b < end1; b++) {
-+			switch(*b) {
-+				case 0x00: if((b[1] & 0x80) == 0) continue; break;
-+				case 0xff: if((b[1] & 0x80) != 0) continue; break;
-+			}
-+			break;
-+		}
-+		
-+		size = end - b;
-+		if(size > sizeof(int64_t)) {
-+			/* Still cannot fit the int64_t */
-+			errno = ERANGE;
-+			return -1;
-+		}
-+	}
-+
-+	/* Shortcut processing of a corner case */
-+	if(end == b) {
-+		*lptr = 0;
-+		return 0;
-+	}
-+
-+	/* Perform the sign initialization */
-+	/* Actually l = -(*b >> 7); gains nothing, yet unreadable! */
-+	if((*b >> 7)) l = -1; else l = 0;
-+
-+	/* Conversion engine */
-+	for(; b < end; b++)
-+		l = (l << 8) | *b;
-+
-+	*lptr = l;
-+	return 0;
-+}
-+
-+int
- asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) {
- 	uint8_t *b, *end;
- 	unsigned long l;
-@@ -857,6 +1220,38 @@
- }
- 
- int
-+asn_INTEGER2uint64(const INTEGER_t *iptr, uint64_t *lptr) {
-+	uint8_t *b, *end;
-+	uint64_t l;
-+	size_t size;
-+	
-+	if(!iptr || !iptr->buf || !lptr) {
-+		errno = EINVAL;
-+		return -1;
-+	}
-+	
-+	b = iptr->buf;
-+	size = iptr->size;
-+	end = b + size;
-+	
-+	/* If all extra leading bytes are zeroes, ignore them */
-+	for(; size > sizeof(uint64_t); b++, size--) {
-+		if(*b) {
-+			/* Value won't fit unsigned long */
-+			errno = ERANGE;
-+			return -1;
-+		}
-+	}
-+	
-+	/* Conversion engine */
-+	for(l = 0; b < end; b++)
-+		l = (l << 8) | *b;
-+	
-+	*lptr = l;
-+	return 0;
-+}
-+
-+int
- asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) {
- 	uint8_t *buf;
- 	uint8_t *end;
-@@ -871,7 +1266,7 @@
- 
- 	end = buf + (sizeof(value) + 1);
- 	buf[0] = 0;
--	for(b = buf + 1, shr = (sizeof(long)-1)*8; b < end; shr -= 8, b++)
-+	for(b = buf + 1, shr = (sizeof(unsigned long)-1)*8; b < end; shr -= 8, b++)
- 		*b = (uint8_t)(value >> shr);
- 
- 	if(st->buf) FREEMEM(st->buf);
-@@ -882,6 +1277,31 @@
- }
- 
- int
-+asn_uint642INTEGER(INTEGER_t *st, uint64_t value) {
-+	uint8_t *buf;
-+	uint8_t *end;
-+	uint8_t *b;
-+	int shr;
-+	
-+	if(value <= INT64_MAX)
-+		return asn_int642INTEGER(st, value);
-+	
-+	buf = (uint8_t *)MALLOC(1 + sizeof(value));
-+	if(!buf) return -1;
-+	
-+	end = buf + (sizeof(value) + 1);
-+	buf[0] = 0;
-+	for(b = buf + 1, shr = (sizeof(value)-1)*8; b < end; shr -= 8, b++)
-+		*b = (uint8_t)(value >> shr);
-+	
-+	if(st->buf) FREEMEM(st->buf);
-+	st->buf = buf;
-+	st->size = 1 + sizeof(value);
-+	
-+	return 0;
-+}
-+
-+int
- asn_long2INTEGER(INTEGER_t *st, long value) {
- 	uint8_t *buf, *bp;
- 	uint8_t *p;
-@@ -1024,3 +1444,60 @@
- 	return ASN_STRTOL_OK;
- }
- 
-+
-+int
-+asn_int642INTEGER(INTEGER_t *st, int64_t value) {
-+	uint8_t *buf, *bp;
-+	uint8_t *p;
-+	uint8_t *pstart;
-+	uint8_t *pend1;
-+	int littleEndian = 1;	/* Run-time detection */
-+	int add;
-+
-+	if(!st) {
-+		errno = EINVAL;
-+		return -1;
-+	}
-+
-+	buf = (uint8_t *)MALLOC(sizeof(value));
-+	if(!buf) return -1;
-+
-+	if(*(char *)&littleEndian) {
-+		pstart = (uint8_t *)&value + sizeof(value) - 1;
-+		pend1 = (uint8_t *)&value;
-+		add = -1;
-+	} else {
-+		pstart = (uint8_t *)&value;
-+		pend1 = pstart + sizeof(value) - 1;
-+		add = 1;
-+	}
-+
-+	/*
-+	 * If the contents octet consists of more than one octet,
-+	 * then bits of the first octet and bit 8 of the second octet:
-+	 * a) shall not all be ones; and
-+	 * b) shall not all be zero.
-+	 */
-+	for(p = pstart; p != pend1; p += add) {
-+		switch(*p) {
-+		case 0x00: if((*(p+add) & 0x80) == 0)
-+				continue;
-+			break;
-+		case 0xff: if((*(p+add) & 0x80))
-+				continue;
-+			break;
-+		}
-+		break;
-+	}
-+	/* Copy the integer body */
-+	for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add)
-+		*bp++ = *p;
-+
-+	if(st->buf) FREEMEM(st->buf);
-+	st->buf = buf;
-+	st->size = bp - buf;
-+
-+	return 0;
-+}
-+
-+
-Index: skeletons/constr_SEQUENCE.c
-===================================================================
---- skeletons/constr_SEQUENCE.c	(revision 1516)
-+++ skeletons/constr_SEQUENCE.c	(working copy)
-@@ -34,7 +34,7 @@
- #undef	ADVANCE
- #define	ADVANCE(num_bytes)	do {		\
- 		size_t num = num_bytes;		\
--		ptr = ((const void *)ptr) + num;\
-+		ptr = ((const char *)ptr) + num;\
- 		size -= num;			\
- 		if(ctx->left >= 0)		\
- 			ctx->left -= num;	\
-@@ -144,7 +144,7 @@
- 	/*
- 	 * Restore parsing context.
- 	 */
--	ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset);
-+	ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
- 	
- 	/*
- 	 * Start to parse where left previously
-@@ -366,7 +366,7 @@
- 					ber_tlv_tag_string(tlv_tag), edx);
- 				skip = ber_skip_length(opt_codec_ctx,
- 					BER_TLV_CONSTRUCTED(ptr),
--					(const void *)ptr + tag_len,
-+					(const char *)ptr + tag_len,
- 					LEFT - tag_len);
- 				ASN_DEBUG("Skip length %d in %s",
- 					(int)skip, td->name);
-@@ -397,13 +397,13 @@
- 		 */
- 		if(elements[edx].flags & ATF_POINTER) {
- 			/* Member is a pointer to another structure */
--			memb_ptr2 = (void **)((void *)st + elements[edx].memb_offset);
-+			memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset);
- 		} else {
- 			/*
- 			 * A pointer to a pointer
- 			 * holding the start of the structure
- 			 */
--			memb_ptr = (void *)st + elements[edx].memb_offset;
-+			memb_ptr = (char *)st + elements[edx].memb_offset;
- 			memb_ptr2 = &memb_ptr;
- 		}
- 		/*
-@@ -489,7 +489,7 @@
- 
- 			ll = ber_skip_length(opt_codec_ctx,
- 				BER_TLV_CONSTRUCTED(ptr),
--				(const void *)ptr + tl, LEFT - tl);
-+				(const char *)ptr + tl, LEFT - tl);
- 			switch(ll) {
- 			case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE);
- 				/* Fall through */
-@@ -528,14 +528,14 @@
- 		asn_TYPE_member_t *elm = &td->elements[edx];
- 		void *memb_ptr;
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(void **)((void *)sptr + elm->memb_offset);
-+			memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
- 			if(!memb_ptr) {
- 				if(elm->optional) continue;
- 				/* Mandatory element is missing */
- 				_ASN_ENCODE_FAILED;
- 			}
- 		} else {
--			memb_ptr = (void *)((void *)sptr + elm->memb_offset);
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
- 		}
- 		erval = elm->type->der_encoder(elm->type, memb_ptr,
- 			elm->tag_mode, elm->tag,
-@@ -567,10 +567,10 @@
- 		void *memb_ptr;
- 
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(void **)((void *)sptr + elm->memb_offset);
-+			memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
- 			if(!memb_ptr) continue;
- 		} else {
--			memb_ptr = (void *)((void *)sptr + elm->memb_offset);
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
- 		}
- 		tmperval = elm->type->der_encoder(elm->type, memb_ptr,
- 			elm->tag_mode, elm->tag,
-@@ -595,7 +595,7 @@
- #undef	XER_ADVANCE
- #define	XER_ADVANCE(num_bytes)	do {			\
- 		size_t num = num_bytes;			\
--		buf_ptr = ((const void *)buf_ptr) + num;\
-+		buf_ptr = ((const char *)buf_ptr) + num;\
- 		size -= num;				\
- 		consumed_myself += num;			\
- 	} while(0)
-@@ -637,7 +637,7 @@
- 	/*
- 	 * Restore parsing context.
- 	 */
--	ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset);
-+	ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
- 
- 
- 	/*
-@@ -667,9 +667,10 @@
- 
- 			if(elm->flags & ATF_POINTER) {
- 				/* Member is a pointer to another structure */
--				memb_ptr2 = (void **)((void *)st + elm->memb_offset);
-+				memb_ptr2 = (void **)((char *)st
-+					+ elm->memb_offset);
- 			} else {
--				memb_ptr = (void *)st + elm->memb_offset;
-+				memb_ptr = (char *)st + elm->memb_offset;
- 				memb_ptr2 = &memb_ptr;
- 			}
- 
-@@ -739,7 +740,7 @@
- 				if(edx >= td->elements_count
- 				   ||
- 				   /* Explicit OPTIONAL specs reaches the end */
--				    (edx + elements[edx].optional
-+					(edx + elements[edx].optional
- 					== td->elements_count)
- 				   ||
- 				   /* All extensions are optional */
-@@ -869,7 +870,7 @@
- 		unsigned int mlen = strlen(mname);
- 
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(void **)((void *)sptr + elm->memb_offset);
-+			memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
- 			if(!memb_ptr) {
- 				if(elm->optional)
- 					continue;
-@@ -877,7 +878,7 @@
- 				_ASN_ENCODE_FAILED;
- 			}
- 		} else {
--			memb_ptr = (void *)((void *)sptr + elm->memb_offset);
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
- 		}
- 
- 		if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel);
-@@ -917,14 +918,14 @@
- 		const void *memb_ptr;
- 
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(const void * const *)((const void *)sptr + elm->memb_offset);
-+			memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
- 			if(!memb_ptr) {
- 				if(elm->optional) continue;
- 				/* Print <absent> line */
- 				/* Fall through */
- 			}
- 		} else {
--			memb_ptr = (const void *)((const void *)sptr + elm->memb_offset);
-+			memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
- 		}
- 
- 		/* Indentation */
-@@ -960,11 +961,11 @@
- 		asn_TYPE_member_t *elm = &td->elements[edx];
- 		void *memb_ptr;
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(void **)((void *)sptr + elm->memb_offset);
-+			memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
- 			if(memb_ptr)
- 				ASN_STRUCT_FREE(*elm->type, memb_ptr);
- 		} else {
--			memb_ptr = (void *)((void *)sptr + elm->memb_offset);
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
- 			ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr);
- 		}
- 	}
-@@ -994,7 +995,7 @@
- 		const void *memb_ptr;
- 
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr = *(const void * const *)((const void *)sptr + elm->memb_offset);
-+			memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
- 			if(!memb_ptr) {
- 				if(elm->optional)
- 					continue;
-@@ -1004,7 +1005,7 @@
- 				return -1;
- 			}
- 		} else {
--			memb_ptr = (const void *)((const void *)sptr + elm->memb_offset);
-+			memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
- 		}
- 
- 		if(elm->memb_constraints) {
-@@ -1088,9 +1089,9 @@
- 
- 		/* Fetch the pointer to this member */
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr2 = (void **)((void *)st + elm->memb_offset);
-+			memb_ptr2 = (void **)((char *)st + elm->memb_offset);
- 		} else {
--			memb_ptr = (void *)st + elm->memb_offset;
-+			memb_ptr = (char *)st + elm->memb_offset;
- 			memb_ptr2 = &memb_ptr;
- 		}
- 
-@@ -1154,11 +1155,224 @@
- 		memset(&epmd, 0, sizeof(epmd));
- 		epmd.buffer = epres;
- 		epmd.nbits = bmlength;
-+		ASN_DEBUG("Read in extensions bitmap for %s of %d bits (%x..)",
-+			td->name, bmlength, *epres);
-+
-+		/* Go over extensions and read them in */
-+		for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) {
-+		asn_TYPE_member_t *elm = &td->elements[edx];
-+		void *memb_ptr;		/* Pointer to the member */
-+		void **memb_ptr2;	/* Pointer to that pointer */
-+		int present;
-+
-+		if(!IN_EXTENSION_GROUP(specs, edx)) {
-+			ASN_DEBUG("%d is not extension", edx);
-+			continue;
-+		}
-+
-+		/* Fetch the pointer to this member */
-+		if(elm->flags & ATF_POINTER) {
-+			memb_ptr2 = (void **)((char *)st + elm->memb_offset);
-+		} else {
-+			memb_ptr = (void *)((char *)st + elm->memb_offset);
-+			memb_ptr2 = &memb_ptr;
-+		}
-+
-+		present = per_get_few_bits(&epmd, 1);
-+		if(present <= 0) {
-+			if(present < 0) break;	/* No more extensions */
-+			continue;
-+		}
-+
-+		ASN_DEBUG("Decoding member %s in %s %p", elm->name, td->name, *memb_ptr2);
-+		rv = uper_open_type_get(opt_codec_ctx, elm->type,
-+			elm->per_constraints, memb_ptr2, pd);
-+		if(rv.code != RC_OK) {
-+			FREEMEM(epres);
-+			return rv;
-+		}
-+		}
-+
-+		/* Skip over overflow extensions which aren't present
-+		 * in this system's version of the protocol */
-+		for(;;) {
-+			ASN_DEBUG("Getting overflow extensions");
-+			switch(per_get_few_bits(&epmd, 1)) {
-+			case -1: break;
-+			case 0: continue;
-+			default:
-+				if(uper_open_type_skip(opt_codec_ctx, pd)) {
-+					FREEMEM(epres);
-+					_ASN_DECODE_STARVED;
-+				}
-+			}
-+			break;
-+		}
-+
-+		FREEMEM(epres);
-+	}
-+
-+	/* Fill DEFAULT members in extensions */
-+	for(edx = specs->roms_count; edx < specs->roms_count
-+			+ specs->aoms_count; edx++) {
-+		asn_TYPE_member_t *elm = &td->elements[edx];
-+		void **memb_ptr2;	/* Pointer to member pointer */
-+
-+		if(!elm->default_value) continue;
-+
-+		/* Fetch the pointer to this member */
-+		if(elm->flags & ATF_POINTER) {
-+			memb_ptr2 = (void **)((char *)st
-+					+ elm->memb_offset);
-+			if(*memb_ptr2) continue;
-+		} else {
-+			continue;	/* Extensions are all optionals */
-+		}
-+
-+		/* Set default value */
-+		if(elm->default_value(1, memb_ptr2)) {
-+			_ASN_DECODE_FAILED;
-+		}
-+	}
-+
-+	rv.consumed = 0;
-+	rv.code = RC_OK;
-+	return rv;
-+}
-+
-+asn_dec_rval_t
-+SEQUENCE_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
-+	asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics;
-+	void *st = *sptr;	/* Target structure. */
-+	int extpresent;		/* Extension additions are present */
-+	uint8_t *opres;		/* Presence of optional root members */
-+	asn_per_data_t opmd;
-+	asn_dec_rval_t rv;
-+	int edx;
-+
-+	(void)constraints;
-+
-+	if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx))
-+		_ASN_DECODE_FAILED;
-+
-+	if(!st) {
-+		st = *sptr = CALLOC(1, specs->struct_size);
-+		if(!st) _ASN_DECODE_FAILED;
-+	}
-+
-+	ASN_DEBUG("Decoding %s as SEQUENCE (APER)", td->name);
-+
-+	/* Handle extensions */
-+	if(specs->ext_before >= 0) {
-+		extpresent = per_get_few_bits(pd, 1);
-+		if(extpresent < 0) _ASN_DECODE_STARVED;
-+	} else {
-+		extpresent = 0;
-+	}
-+
-+	/* Prepare a place and read-in the presence bitmap */
-+	memset(&opmd, 0, sizeof(opmd));
-+	if(specs->roms_count) {
-+		opres = (uint8_t *)MALLOC(((specs->roms_count + 7) >> 3) + 1);
-+		if(!opres) _ASN_DECODE_FAILED;
-+		/* Get the presence map */
-+		if(per_get_many_bits(pd, opres, 0, specs->roms_count)) {
-+			FREEMEM(opres);
-+			_ASN_DECODE_STARVED;
-+		}
-+		opmd.buffer = opres;
-+		opmd.nbits = specs->roms_count;
-+		ASN_DEBUG("Read in presence bitmap for %s of %d bits (%x..)",
-+			td->name, specs->roms_count, *opres);
-+	} else {
-+		opres = 0;
-+	}
-+
-+	/*
-+	 * Get the sequence ROOT elements.
-+	 */
-+	for(edx = 0; edx < td->elements_count; edx++) {
-+		asn_TYPE_member_t *elm = &td->elements[edx];
-+		void *memb_ptr;		/* Pointer to the member */
-+		void **memb_ptr2;	/* Pointer to that pointer */
-+
-+		if(IN_EXTENSION_GROUP(specs, edx))
-+			continue;
-+
-+		/* Fetch the pointer to this member */
-+		if(elm->flags & ATF_POINTER) {
-+			memb_ptr2 = (void **)((char *)st + elm->memb_offset);
-+		} else {
-+			memb_ptr = (char *)st + elm->memb_offset;
-+			memb_ptr2 = &memb_ptr;
-+		}
-+
-+		/* Deal with optionality */
-+		if(elm->optional) {
-+			int present = per_get_few_bits(&opmd, 1);
-+			ASN_DEBUG("Member %s->%s is optional, p=%d (%d->%d)",
-+				td->name, elm->name, present,
-+				(int)opmd.nboff, (int)opmd.nbits);
-+			if(present == 0) {
-+				/* This element is not present */
-+				if(elm->default_value) {
-+					/* Fill-in DEFAULT */
-+					if(elm->default_value(1, memb_ptr2)) {
-+						FREEMEM(opres);
-+						_ASN_DECODE_FAILED;
-+					}
-+					ASN_DEBUG("Filled-in default");
-+				}
-+				/* The member is just not present */
-+				continue;
-+			}
-+			/* Fall through */
-+		}
-+
-+		/* Fetch the member from the stream */
-+		ASN_DEBUG("Decoding member %s in %s", elm->name, td->name);
-+		rv = elm->type->aper_decoder(opt_codec_ctx, elm->type,
-+			elm->per_constraints, memb_ptr2, pd);
-+		if(rv.code != RC_OK) {
-+			ASN_DEBUG("Failed decode %s in %s",
-+				elm->name, td->name);
-+			FREEMEM(opres);
-+			return rv;
-+		}
-+	}
-+
-+	/* Optionality map is not needed anymore */
-+	FREEMEM(opres);
-+
-+	/*
-+	 * Deal with extensions.
-+	 */
-+	if(extpresent) {
-+		ssize_t bmlength;
-+		uint8_t *epres;		/* Presence of extension members */
-+		asn_per_data_t epmd;
-+
-+		bmlength = uper_get_nslength(pd);
-+		if(bmlength < 0) _ASN_DECODE_STARVED;
-+
-+		ASN_DEBUG("Extensions %d present in %s", bmlength, td->name);
-+
-+		epres = (uint8_t *)MALLOC((bmlength + 15) >> 3);
-+		if(!epres) _ASN_DECODE_STARVED;
-+
-+		/* Get the extensions map */
-+		if(per_get_many_bits(pd, epres, 0, bmlength))
-+			_ASN_DECODE_STARVED;
-+
-+		memset(&epmd, 0, sizeof(epmd));
-+		epmd.buffer = epres;
-+		epmd.nbits = bmlength;
- 		ASN_DEBUG("Read in extensions bitmap for %s of %ld bits (%x..)",
- 			td->name, (long)bmlength, *epres);
- 
--	    /* Go over extensions and read them in */
--	    for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) {
-+		/* Go over extensions and read them in */
-+		for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) {
- 		asn_TYPE_member_t *elm = &td->elements[edx];
- 		void *memb_ptr;		/* Pointer to the member */
- 		void **memb_ptr2;	/* Pointer to that pointer */
-@@ -1171,9 +1385,9 @@
- 
- 		/* Fetch the pointer to this member */
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr2 = (void **)((void *)st + elm->memb_offset);
-+			memb_ptr2 = (void **)((char *)st + elm->memb_offset);
- 		} else {
--			memb_ptr = (void *)((void *)st + elm->memb_offset);
-+			memb_ptr = (void *)((char *)st + elm->memb_offset);
- 			memb_ptr2 = &memb_ptr;
- 		}
- 
-@@ -1190,7 +1404,7 @@
- 			FREEMEM(epres);
- 			return rv;
- 		}
--	    }
-+		}
- 
- 		/* Skip over overflow extensions which aren't present
- 		 * in this system's version of the protocol */
-@@ -1221,7 +1435,7 @@
- 
- 		/* Fetch the pointer to this member */
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr2 = (void **)((void *)st
-+			memb_ptr2 = (void **)((char *)st
- 					+ elm->memb_offset);
- 			if(*memb_ptr2) continue;
- 		} else {
-@@ -1265,10 +1479,10 @@
- 
- 		/* Fetch the pointer to this member */
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr2 = (void **)((void *)sptr + elm->memb_offset);
-+			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
- 			present = (*memb_ptr2 != 0);
- 		} else {
--			memb_ptr = (void *)((void *)sptr + elm->memb_offset);
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
- 			memb_ptr2 = &memb_ptr;
- 			present = 1;
- 		}
-@@ -1334,10 +1548,10 @@
- 
- 		/* Fetch the pointer to this member */
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr2 = (void **)((void *)sptr + elm->memb_offset);
-+			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
- 			present = (*memb_ptr2 != 0);
- 		} else {
--			memb_ptr = (void *)((void *)sptr + elm->memb_offset);
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
- 			memb_ptr2 = &memb_ptr;
- 			present = 1;
- 		}
-@@ -1373,7 +1587,7 @@
- 
- 		/* Fetch the pointer to this member */
- 		if(elm->flags & ATF_POINTER) {
--			memb_ptr2 = (void **)((void *)sptr + elm->memb_offset);
-+			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
- 			if(!*memb_ptr2) {
- 				ASN_DEBUG("Element %s %d not present",
- 					elm->name, edx);
-@@ -1383,7 +1597,7 @@
- 				_ASN_ENCODE_FAILED;
- 			}
- 		} else {
--			memb_ptr = (void *)((void *)sptr + elm->memb_offset);
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
- 			memb_ptr2 = &memb_ptr;
- 		}
- 
-@@ -1420,3 +1634,130 @@
- 	_ASN_ENCODED_OK(er);
- }
- 
-+asn_enc_rval_t
-+SEQUENCE_encode_aper(asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-+	asn_SEQUENCE_specifics_t *specs
-+		= (asn_SEQUENCE_specifics_t *)td->specifics;
-+	asn_enc_rval_t er;
-+	int n_extensions;
-+	int edx;
-+	int i;
-+
-+	(void)constraints;
-+
-+	if(!sptr)
-+		_ASN_ENCODE_FAILED;
-+
-+	er.encoded = 0;
-+
-+	ASN_DEBUG("Encoding %s as SEQUENCE (APER)", td->name);
-+
-+	/*
-+	 * X.691#18.1 Whether structure is extensible
-+	 * and whether to encode extensions
-+	 */
-+	if(specs->ext_before >= 0) {
-+		n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0);
-+		per_put_few_bits(po, n_extensions ? 1 : 0, 1);
-+	} else {
-+		n_extensions = 0;	   /* There are no extensions to encode */
-+	}
-+
-+	/* Encode a presence bitmap */
-+	for(i = 0; i < specs->roms_count; i++) {
-+		asn_TYPE_member_t *elm;
-+		void *memb_ptr;	 /* Pointer to the member */
-+		void **memb_ptr2;	   /* Pointer to that pointer */
-+		int present;
-+
-+		edx = specs->oms[i];
-+		elm = &td->elements[edx];
-+
-+		/* Fetch the pointer to this member */
-+		if(elm->flags & ATF_POINTER) {
-+			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
-+			present = (*memb_ptr2 != 0);
-+		} else {
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
-+			memb_ptr2 = &memb_ptr;
-+			present = 1;
-+		}
-+
-+		/* Eliminate default values */
-+		if(present && elm->default_value
-+		&& elm->default_value(0, memb_ptr2) == 1)
-+			present = 0;
-+
-+		ASN_DEBUG("Element %s %s %s->%s is %s",
-+			elm->flags & ATF_POINTER ? "ptr" : "inline",
-+			elm->default_value ? "def" : "wtv",
-+			td->name, elm->name, present ? "present" : "absent");
-+		if(per_put_few_bits(po, present, 1))
-+			_ASN_ENCODE_FAILED;
-+	}
-+
-+	/*
-+	 * Encode the sequence ROOT elements.
-+	 */
-+	ASN_DEBUG("ext_after = %d, ec = %d, eb = %d", specs->ext_after, td->elements_count, specs->ext_before);
-+	for(edx = 0; edx < ((specs->ext_after < 0)
-+		? td->elements_count : specs->ext_before - 1); edx++) {
-+
-+		asn_TYPE_member_t *elm = &td->elements[edx];
-+		void *memb_ptr;	 /* Pointer to the member */
-+		void **memb_ptr2;	   /* Pointer to that pointer */
-+
-+		if(IN_EXTENSION_GROUP(specs, edx))
-+			continue;
-+
-+		ASN_DEBUG("About to encode %s", elm->type->name);
-+
-+		/* Fetch the pointer to this member */
-+		if(elm->flags & ATF_POINTER) {
-+			memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
-+			if(!*memb_ptr2) {
-+				ASN_DEBUG("Element %s %d not present",
-+					elm->name, edx);
-+				if(elm->optional)
-+					continue;
-+				/* Mandatory element is missing */
-+				_ASN_ENCODE_FAILED;
-+			}
-+		} else {
-+			memb_ptr = (void *)((char *)sptr + elm->memb_offset);
-+			memb_ptr2 = &memb_ptr;
-+		}
-+
-+		/* Eliminate default values */
-+		if(elm->default_value && elm->default_value(0, memb_ptr2) == 1)
-+			continue;
-+
-+		ASN_DEBUG("Encoding %s->%s", td->name, elm->name);
-+		er = elm->type->aper_encoder(elm->type, elm->per_constraints,
-+			*memb_ptr2, po);
-+		if(er.encoded == -1)
-+			return er;
-+	}
-+
-+	/* No extensions to encode */
-+	if(!n_extensions) _ASN_ENCODED_OK(er);
-+
-+	ASN_DEBUG("Length of %d bit-map", n_extensions);
-+	/* #18.8. Write down the presence bit-map length. */
-+	if(aper_put_nslength(po, n_extensions))
-+		_ASN_ENCODE_FAILED;
-+
-+	ASN_DEBUG("Bit-map of %d elements", n_extensions);
-+	/* #18.7. Encoding the extensions presence bit-map. */
-+	/* TODO: act upon NOTE in #18.7 for canonical PER */
-+	if(SEQUENCE_handle_extensions(td, sptr, po, 0) != n_extensions)
-+		_ASN_ENCODE_FAILED;
-+
-+	ASN_DEBUG("Writing %d extensions", n_extensions);
-+	/* #18.9. Encode extensions as open type fields. */
-+	if(SEQUENCE_handle_extensions(td, sptr, 0, po) != n_extensions)
-+		_ASN_ENCODE_FAILED;
-+
-+	_ASN_ENCODED_OK(er);
-+}
-Index: skeletons/INTEGER.h
-===================================================================
---- skeletons/INTEGER.h	(revision 1516)
-+++ skeletons/INTEGER.h	(working copy)
-@@ -41,6 +41,8 @@
- xer_type_encoder_f INTEGER_encode_xer;
- per_type_decoder_f INTEGER_decode_uper;
- per_type_encoder_f INTEGER_encode_uper;
-+per_type_decoder_f INTEGER_decode_aper;
-+per_type_encoder_f INTEGER_encode_aper;
- 
- /***********************************
-  * Some handy conversion routines. *
-@@ -52,8 +54,12 @@
-  * -1/ERANGE: Value encoded is out of range for long representation
-  * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()).
-  */
-+int asn_INTEGER2int64(const INTEGER_t *i, int64_t *l);
-+int asn_INTEGER2uint64(const INTEGER_t *i, uint64_t *l);
- int asn_INTEGER2long(const INTEGER_t *i, long *l);
- int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l);
-+int asn_int642INTEGER(INTEGER_t *i, int64_t l);
-+int asn_uint642INTEGER(INTEGER_t *i, uint64_t l);
- int asn_long2INTEGER(INTEGER_t *i, long l);
- int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l);
- 
-Index: skeletons/OCTET_STRING.c
-===================================================================
---- skeletons/OCTET_STRING.c	(revision 1516)
-+++ skeletons/OCTET_STRING.c	(working copy)
-@@ -36,6 +36,8 @@
- 	OCTET_STRING_encode_xer,
- 	OCTET_STRING_decode_uper,	/* Unaligned PER decoder */
- 	OCTET_STRING_encode_uper,	/* Unaligned PER encoder */
-+	OCTET_STRING_decode_aper,	/* Aligned PER decoder */
-+	OCTET_STRING_encode_aper,	/* Aligned PER encoder */
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_OCTET_STRING_tags,
- 	sizeof(asn_DEF_OCTET_STRING_tags)
-@@ -86,7 +88,7 @@
- 			void *ptr;					\
- 			/* Be nice and round to the memory allocator */	\
- 			do { _ns = _ns ? _ns << 1 : 16; }		\
--			    while(_ns <= _es);				\
-+				while(_ns <= _es);				\
- 			/* int is really a typeof(st->size): */		\
- 			if((int)_ns < 0) RETURN(RC_FAIL);		\
- 			ptr = REALLOC(st->buf, _ns);			\
-@@ -195,7 +197,7 @@
- 	}
- 
- 	/* Restore parsing context */
--	ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset);
-+	ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
- 
- 	switch(ctx->phase) {
- 	case 0:
-@@ -416,7 +418,7 @@
- 		ASN_DEBUG("Phase 2: Need %ld bytes, size=%ld, alrg=%ld, wn=%d",
- 			(long)sel->left, (long)size, (long)sel->got,
- 				sel->want_nulls);
--	    {
-+		{
- 		ber_tlv_len_t len;
- 
- 		assert(sel->left >= 0);
-@@ -446,7 +448,7 @@
- 
- 		PREV_PHASE(ctx);
- 		goto phase1;
--	    }
-+		}
- 		break;
- 	case 3:
- 	phase3:
-@@ -1143,7 +1145,7 @@
- 	}
- 
- 	/* Restore parsing context */
--	ctx = (asn_struct_ctx_t *)(((void *)*sptr) + specs->ctx_offset);
-+	ctx = (asn_struct_ctx_t *)(((char *)*sptr) + specs->ctx_offset);
- 
- 	return xer_decode_general(opt_codec_ctx, ctx, *sptr, xml_tag,
- 		buf_ptr, size, opt_unexpected_tag_decoder, body_receiver);
-@@ -1392,7 +1394,7 @@
- 		if(!st) RETURN(RC_FAIL);
- 	}
- 
--	ASN_DEBUG("PER Decoding %s size %ld .. %ld bits %d",
-+	ASN_DEBUG("PER Decoding %s size %"PRIdMAX" .. %"PRIdMAX" bits %d",
- 		csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible",
- 		csiz->lower_bound, csiz->upper_bound, csiz->effective_bits);
- 
-@@ -1423,17 +1425,17 @@
- 	if(csiz->effective_bits == 0) {
- 		int ret;
- 		if(bpc) {
--			ASN_DEBUG("Encoding OCTET STRING size %ld",
-+			ASN_DEBUG("Encoding OCTET STRING size %"PRIdMAX,
- 				csiz->upper_bound);
- 			ret = OCTET_STRING_per_get_characters(pd, st->buf,
- 				csiz->upper_bound, bpc, unit_bits,
- 				cval->lower_bound, cval->upper_bound, pc);
- 			if(ret > 0) RETURN(RC_FAIL);
- 		} else {
--			ASN_DEBUG("Encoding BIT STRING size %ld",
-+			ASN_DEBUG("Encoding BIT STRING size %"PRIdMAX,
- 				csiz->upper_bound);
- 			ret = per_get_many_bits(pd, st->buf, 0,
--					    unit_bits * csiz->upper_bound);
-+						unit_bits * csiz->upper_bound);
- 		}
- 		if(ret < 0) RETURN(RC_WMORE);
- 		consumed_myself += unit_bits * csiz->upper_bound;
-@@ -1492,9 +1494,197 @@
- 	return rval;
- }
- 
-+asn_dec_rval_t
-+OCTET_STRING_decode_aper(asn_codec_ctx_t *opt_codec_ctx,
-+	asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
-+	void **sptr, asn_per_data_t *pd) {
-+
-+	asn_OCTET_STRING_specifics_t *specs = td->specifics
-+		? (asn_OCTET_STRING_specifics_t *)td->specifics
-+		: &asn_DEF_OCTET_STRING_specs;
-+	asn_per_constraints_t *pc = constraints ? constraints
-+				: td->per_constraints;
-+	asn_per_constraint_t *cval;
-+	asn_per_constraint_t *csiz;
-+	asn_dec_rval_t rval = { RC_OK, 0 };
-+	BIT_STRING_t *st = (BIT_STRING_t *)*sptr;
-+	ssize_t consumed_myself = 0;
-+	int repeat;
-+	enum {
-+		OS__BPC_BIT	= 0,
-+		OS__BPC_CHAR	= 1,
-+		OS__BPC_U16	= 2,
-+		OS__BPC_U32	= 4
-+	} bpc;	/* Bytes per character */
-+	unsigned int unit_bits;
-+	unsigned int canonical_unit_bits;
-+
-+	(void)opt_codec_ctx;
-+
-+	if(pc) {
-+		cval = &pc->value;
-+		csiz = &pc->size;
-+	} else {
-+		cval = &asn_DEF_OCTET_STRING_constraints.value;
-+		csiz = &asn_DEF_OCTET_STRING_constraints.size;
-+	}
-+
-+	switch(specs->subvariant) {
-+	default:
-+// 	case ASN_OSUBV_ANY:
-+// 		ASN_DEBUG("Unrecognized subvariant %d", specs->subvariant);
-+// 		RETURN(RC_FAIL);
-+	case ASN_OSUBV_BIT:
-+		canonical_unit_bits = unit_bits = 1;
-+		bpc = OS__BPC_BIT;
-+		break;
-+	case ASN_OSUBV_ANY:
-+	case ASN_OSUBV_STR:
-+		canonical_unit_bits = unit_bits = 8;
-+// 		if(cval->flags & APC_CONSTRAINED)
-+// 			unit_bits = cval->range_bits;
-+		bpc = OS__BPC_CHAR;
-+		break;
-+	case ASN_OSUBV_U16:
-+		canonical_unit_bits = unit_bits = 16;
-+		if(cval->flags & APC_CONSTRAINED)
-+			unit_bits = cval->range_bits;
-+		bpc = OS__BPC_U16;
-+		break;
-+	case ASN_OSUBV_U32:
-+		canonical_unit_bits = unit_bits = 32;
-+		if(cval->flags & APC_CONSTRAINED)
-+			unit_bits = cval->range_bits;
-+		bpc = OS__BPC_U32;
-+		break;
-+	}
-+
-+	/*
-+	 * Allocate the string.
-+	 */
-+	if(!st) {
-+		st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size));
-+		if(!st) RETURN(RC_FAIL);
-+	}
-+
-+	ASN_DEBUG("PER Decoding %s size %"PRIdMAX" .. %"PRIdMAX" bits %d",
-+		csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible",
-+		csiz->lower_bound, csiz->upper_bound, csiz->effective_bits);
-+
-+	if(csiz->flags & APC_EXTENSIBLE) {
-+		int inext = per_get_few_bits(pd, 1);
-+		if(inext < 0) RETURN(RC_WMORE);
-+		if(inext) {
-+			csiz = &asn_DEF_OCTET_STRING_constraints.size;
-+			cval = &asn_DEF_OCTET_STRING_constraints.value;
-+			unit_bits = canonical_unit_bits;
-+		}
-+	}
-+
-+	if(csiz->effective_bits >= 0) {
-+		FREEMEM(st->buf);
-+		if(bpc) {
-+			st->size = csiz->upper_bound * bpc;
-+		} else {
-+			st->size = (csiz->upper_bound + 7) >> 3;
-+		}
-+		st->buf = (uint8_t *)MALLOC(st->size + 1);
-+		if(!st->buf) { st->size = 0; RETURN(RC_FAIL); }
-+	}
-+
-+	/* X.691, #16.5: zero-length encoding */
-+	/* X.691, #16.6: short fixed length encoding (up to 2 octets) */
-+	/* X.691, #16.7: long fixed length encoding (up to 64K octets) */
-+	if(csiz->effective_bits == 0) {
-+		int ret;
-+		if (st->size > 2) { /* X.691 #16 NOTE 1 */
-+			if (aper_get_align(pd) < 0)
-+				RETURN(RC_FAIL);
-+		}
-+		if(bpc) {
-+			ASN_DEBUG("Decoding OCTET STRING size %"PRIdMAX,
-+				csiz->upper_bound);
-+			ret = OCTET_STRING_per_get_characters(pd, st->buf,
-+				csiz->upper_bound, bpc, unit_bits,
-+				cval->lower_bound, cval->upper_bound, pc);
-+			if(ret > 0) RETURN(RC_FAIL);
-+		} else {
-+			ASN_DEBUG("Decoding BIT STRING size %"PRIdMAX,
-+				csiz->upper_bound);
-+			ret = per_get_many_bits(pd, st->buf, 0,
-+						unit_bits * csiz->upper_bound);
-+		}
-+		if(ret < 0) RETURN(RC_WMORE);
-+		consumed_myself += unit_bits * csiz->upper_bound;
-+		st->buf[st->size] = 0;
-+		if(bpc == 0) {
-+			int ubs = (csiz->upper_bound & 0x7);
-+			st->bits_unused = ubs ? 8 - ubs : 0;
-+		}
-+		RETURN(RC_OK);
-+	}
-+
-+	st->size = 0;
-+	do {
-+		ssize_t raw_len;
-+		ssize_t len_bytes;
-+		ssize_t len_bits;
-+		void *p;
-+		int ret;
-+
-+		/* Get the PER length */
-+		if (csiz->upper_bound - csiz->lower_bound == 0)
-+			// Indefinite length case
-+			raw_len = aper_get_length(pd, -1, csiz->effective_bits, &repeat);
-+		else
-+			raw_len = aper_get_length(pd, csiz->upper_bound - csiz->lower_bound + 1, csiz->effective_bits, &repeat);
-+		repeat = 0;
-+		if(raw_len < 0) RETURN(RC_WMORE);
-+		raw_len += csiz->lower_bound;
-+
-+		ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)",
-+			(long)csiz->effective_bits, (long)raw_len,
-+			repeat ? "repeat" : "once", td->name);
-+
-+		if (raw_len > 2) { /* X.691 #16 NOTE 1 */
-+			if (aper_get_align(pd) < 0)
-+				RETURN(RC_FAIL);
-+		}
-+
-+		if(bpc) {
-+			len_bytes = raw_len * bpc;
-+			len_bits = len_bytes * unit_bits;
-+		} else {
-+			len_bits = raw_len;
-+			len_bytes = (len_bits + 7) >> 3;
-+			if(len_bits & 0x7)
-+				st->bits_unused = 8 - (len_bits & 0x7);
-+			/* len_bits be multiple of 16K if repeat is set */
-+		}
-+		p = REALLOC(st->buf, st->size + len_bytes + 1);
-+		if(!p) RETURN(RC_FAIL);
-+		st->buf = (uint8_t *)p;
-+
-+		if(bpc) {
-+			ret = OCTET_STRING_per_get_characters(pd,
-+				&st->buf[st->size], raw_len, bpc, unit_bits,
-+				cval->lower_bound, cval->upper_bound, pc);
-+			if(ret > 0) RETURN(RC_FAIL);
-+		} else {
-+			ret = per_get_many_bits(pd, &st->buf[st->size],
-+				0, len_bits);
-+		}
-+		if(ret < 0) RETURN(RC_WMORE);
-+		st->size += len_bytes;
-+	} while(repeat);
-+	st->buf[st->size] = 0;	/* nul-terminate */
-+
-+	return rval;
-+}
-+
- asn_enc_rval_t
- OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td,
--        asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-+		asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
- 
- 	asn_OCTET_STRING_specifics_t *specs = td->specifics
- 		? (asn_OCTET_STRING_specifics_t *)td->specifics
-@@ -1566,7 +1756,7 @@
- 	}
- 
- 	ASN_DEBUG("Encoding %s into %d units of %d bits"
--		" (%ld..%ld, effective %d)%s",
-+		" (%"PRIdMAX"..%"PRIdMAX", effective %d)%s",
- 		td->name, sizeinunits, unit_bits,
- 		csiz->lower_bound, csiz->upper_bound,
- 		csiz->effective_bits, ct_extensible ? " EXT" : "");
-@@ -1598,7 +1788,7 @@
- 	/* X.691, #16.6: short fixed length encoding (up to 2 octets) */
- 	/* X.691, #16.7: long fixed length encoding (up to 64K octets) */
- 	if(csiz->effective_bits >= 0) {
--		ASN_DEBUG("Encoding %d bytes (%ld), length in %d bits",
-+		ASN_DEBUG("Encoding %d bytes (%"PRIdMAX"), length in %d bits",
- 				st->size, sizeinunits - csiz->lower_bound,
- 				csiz->effective_bits);
- 		ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound,
-@@ -1652,6 +1842,173 @@
- 	_ASN_ENCODED_OK(er);
- }
- 
-+asn_enc_rval_t
-+OCTET_STRING_encode_aper(asn_TYPE_descriptor_t *td,
-+		asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-+
-+		asn_OCTET_STRING_specifics_t *specs = td->specifics
-+				? (asn_OCTET_STRING_specifics_t *)td->specifics
-+				: &asn_DEF_OCTET_STRING_specs;
-+		asn_per_constraints_t *pc = constraints ? constraints
-+								: td->per_constraints;
-+		asn_per_constraint_t *cval;
-+		asn_per_constraint_t *csiz;
-+		const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
-+		asn_enc_rval_t er = { 0, 0, 0 };
-+		int inext = 0;		  /* Lies not within extension root */
-+		unsigned int unit_bits;
-+		unsigned int canonical_unit_bits;
-+		unsigned int sizeinunits;
-+		const uint8_t *buf;
-+		int ret;
-+		enum {
-+				OS__BPC_BIT	 = 0,
-+				OS__BPC_CHAR	= 1,
-+				OS__BPC_U16	 = 2,
-+				OS__BPC_U32	 = 4
-+		} bpc;  /* Bytes per character */
-+		int ct_extensible;
-+
-+		if(!st || (!st->buf && st->size))
-+				_ASN_ENCODE_FAILED;
-+
-+		if(pc) {
-+				cval = &pc->value;
-+				csiz = &pc->size;
-+		} else {
-+				cval = &asn_DEF_OCTET_STRING_constraints.value;
-+				csiz = &asn_DEF_OCTET_STRING_constraints.size;
-+		}
-+		ct_extensible = csiz->flags & APC_EXTENSIBLE;
-+
-+		switch(specs->subvariant) {
-+		default:
-+//		 case ASN_OSUBV_ANY:
-+//				 _ASN_ENCODE_FAILED;
-+		case ASN_OSUBV_BIT:
-+				canonical_unit_bits = unit_bits = 1;
-+				bpc = OS__BPC_BIT;
-+				sizeinunits = st->size * 8 - (st->bits_unused & 0x07);
-+				ASN_DEBUG("BIT STRING of %d bits",
-+								sizeinunits);
-+		break;
-+		case ASN_OSUBV_ANY:
-+	case ASN_OSUBV_STR:
-+		canonical_unit_bits = unit_bits = 8;
-+// 		if(cval->flags & APC_CONSTRAINED)
-+// 			unit_bits = 8;
-+		bpc = OS__BPC_CHAR;
-+		sizeinunits = st->size;
-+		break;
-+	case ASN_OSUBV_U16:
-+		canonical_unit_bits = unit_bits = 16;
-+		if(cval->flags & APC_CONSTRAINED)
-+			unit_bits = cval->range_bits;
-+		bpc = OS__BPC_U16;
-+		sizeinunits = st->size / 2;
-+		break;
-+	case ASN_OSUBV_U32:
-+		canonical_unit_bits = unit_bits = 32;
-+		if(cval->flags & APC_CONSTRAINED)
-+			unit_bits = cval->range_bits;
-+		bpc = OS__BPC_U32;
-+		sizeinunits = st->size / 4;
-+		break;
-+	}
-+
-+	ASN_DEBUG("Encoding %s into %d units of %d bits"
-+		" (%"PRIdMAX"..%"PRIdMAX", effective %d)%s",
-+		td->name, sizeinunits, unit_bits,
-+		csiz->lower_bound, csiz->upper_bound,
-+		csiz->effective_bits, ct_extensible ? " EXT" : "");
-+
-+	/* Figure out wheter size lies within PER visible constraint */
-+
-+	if(csiz->effective_bits >= 0) {
-+		if((int)sizeinunits < csiz->lower_bound
-+		|| (int)sizeinunits > csiz->upper_bound) {
-+			if(ct_extensible) {
-+				cval = &asn_DEF_OCTET_STRING_constraints.value;
-+				csiz = &asn_DEF_OCTET_STRING_constraints.size;
-+				unit_bits = canonical_unit_bits;
-+				inext = 1;
-+			} else
-+				_ASN_ENCODE_FAILED;
-+		}
-+	} else {
-+		inext = 0;
-+	}
-+
-+
-+	if(ct_extensible) {
-+		/* Declare whether length is [not] within extension root */
-+		if(per_put_few_bits(po, inext, 1))
-+			_ASN_ENCODE_FAILED;
-+	}
-+
-+	/* X.691, #16.5: zero-length encoding */
-+	/* X.691, #16.6: short fixed length encoding (up to 2 octets) */
-+	/* X.691, #16.7: long fixed length encoding (up to 64K octets) */
-+	if(csiz->effective_bits >= 0) {
-+		ASN_DEBUG("Encoding %d bytes (%"PRIdMAX"), length in %d bits",
-+				st->size, sizeinunits - csiz->lower_bound,
-+				csiz->effective_bits);
-+		ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound,
-+				csiz->effective_bits);
-+		if(ret) _ASN_ENCODE_FAILED;
-+		if (st->size > 2) { /* X.691 #16 NOTE 1 */
-+			if (aper_put_align(po) < 0)
-+				_ASN_ENCODE_FAILED;
-+		}
-+		if(bpc) {
-+			ret = OCTET_STRING_per_put_characters(po, st->buf,
-+				sizeinunits, bpc, unit_bits,
-+				cval->lower_bound, cval->upper_bound, pc);
-+		} else {
-+			ret = per_put_many_bits(po, st->buf,
-+				sizeinunits * unit_bits);
-+		}
-+		if(ret) _ASN_ENCODE_FAILED;
-+		_ASN_ENCODED_OK(er);
-+	}
-+
-+	ASN_DEBUG("Encoding %d bytes", st->size);
-+
-+	if(sizeinunits == 0) {
-+		if(aper_put_length(po, -1, 0))
-+			_ASN_ENCODE_FAILED;
-+		_ASN_ENCODED_OK(er);
-+	}
-+
-+	buf = st->buf;
-+	while(sizeinunits) {
-+		ssize_t maySave = aper_put_length(po, -1, sizeinunits);
-+
-+		if(maySave < 0) _ASN_ENCODE_FAILED;
-+
-+		ASN_DEBUG("Encoding %ld of %ld",
-+			(long)maySave, (long)sizeinunits);
-+
-+		if(bpc) {
-+			ret = OCTET_STRING_per_put_characters(po, buf,
-+				maySave, bpc, unit_bits,
-+				cval->lower_bound, cval->upper_bound, pc);
-+		} else {
-+			ret = per_put_many_bits(po, buf, maySave * unit_bits);
-+		}
-+		if(ret) _ASN_ENCODE_FAILED;
-+
-+		if(bpc)
-+			buf += maySave * bpc;
-+		else
-+			buf += maySave >> 3;
-+		sizeinunits -= maySave;
-+		assert(!(maySave & 0x07) || !sizeinunits);
-+	}
-+
-+	_ASN_ENCODED_OK(er);
-+}
-+
- int
- OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
- 	asn_app_consume_bytes_f *cb, void *app_key) {
-@@ -1716,7 +2073,7 @@
- 				? (asn_OCTET_STRING_specifics_t *)td->specifics
- 				: &asn_DEF_OCTET_STRING_specs;
- 	asn_struct_ctx_t *ctx = (asn_struct_ctx_t *)
--					((void *)st + specs->ctx_offset);
-+					((char *)st + specs->ctx_offset);
- 	struct _stack *stck;
- 
- 	if(!td || !st)
-Index: skeletons/BIT_STRING.c
-===================================================================
---- skeletons/BIT_STRING.c	(revision 1516)
-+++ skeletons/BIT_STRING.c	(working copy)
-@@ -29,6 +29,8 @@
- 	BIT_STRING_encode_xer,
- 	OCTET_STRING_decode_uper,	/* Unaligned PER decoder */
- 	OCTET_STRING_encode_uper,	/* Unaligned PER encoder */
-+	OCTET_STRING_decode_aper,	/* Aligned PER decoder */
-+	OCTET_STRING_encode_aper,	/* Aligned PER encoder */
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_BIT_STRING_tags,
- 	sizeof(asn_DEF_BIT_STRING_tags)
-Index: skeletons/NativeInteger.c
-===================================================================
---- skeletons/NativeInteger.c	(revision 1516)
-+++ skeletons/NativeInteger.c	(working copy)
-@@ -31,6 +31,8 @@
- 	NativeInteger_encode_xer,
- 	NativeInteger_decode_uper,	/* Unaligned PER decoder */
- 	NativeInteger_encode_uper,	/* Unaligned PER encoder */
-+	NativeInteger_decode_aper,	/* Aligned PER decoder */
-+	NativeInteger_encode_aper,	/* Aligned PER encoder */
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_NativeInteger_tags,
- 	sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]),
-@@ -267,6 +269,46 @@
- 	return rval;
- }
- 
-+asn_dec_rval_t
-+NativeInteger_decode_aper(asn_codec_ctx_t *opt_codec_ctx,
-+	asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
-+
-+	asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
-+	asn_dec_rval_t rval;
-+	long *native = (long *)*sptr;
-+	INTEGER_t tmpint;
-+	void *tmpintptr = &tmpint;
-+	int dynamic = 0;
-+
-+	(void)opt_codec_ctx;
-+	ASN_DEBUG("Decoding NativeInteger %s (APER)", td->name);
-+
-+	if(!native) {
-+		native = (long *)(*sptr = CALLOC(1, sizeof(*native)));
-+		dynamic = 1;
-+		if(!native) _ASN_DECODE_FAILED;
-+	}
-+
-+	memset(&tmpint, 0, sizeof tmpint);
-+	rval = INTEGER_decode_aper(opt_codec_ctx, td, constraints,
-+				   &tmpintptr, pd);
-+	if(rval.code == RC_OK) {
-+		if((specs&&specs->field_unsigned)
-+			? asn_INTEGER2ulong(&tmpint, (unsigned long *)native)
-+			: asn_INTEGER2long(&tmpint, native))
-+			rval.code = RC_FAIL;
-+		else
-+			ASN_DEBUG("NativeInteger %s got value %ld",
-+				td->name, *native);
-+	}
-+	ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);
-+	//if (dynamic)
-+	//	free(native);
-+
-+	return rval;
-+}
-+
- asn_enc_rval_t
- NativeInteger_encode_uper(asn_TYPE_descriptor_t *td,
- 	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-@@ -291,6 +333,44 @@
- 	return er;
- }
- 
-+asn_enc_rval_t
-+NativeInteger_encode_aper(
-+	asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-+
-+	asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
-+	asn_enc_rval_t er;
-+	INTEGER_t tmpint;
-+
-+	if(!sptr) _ASN_ENCODE_FAILED;
-+	memset(&tmpint, 0, sizeof(tmpint));
-+
-+	if(specs&&specs->field_unsigned) {
-+		unsigned long native;
-+		native = *(unsigned long *)sptr;
-+
-+		ASN_DEBUG("Encoding NativeInteger %s %lu (APER) (unsigned)", td->name, native);
-+
-+		if(asn_ulong2INTEGER(&tmpint, native))
-+			_ASN_ENCODE_FAILED;
-+	} else {
-+		long native;
-+		native = *(long *)sptr;
-+
-+		ASN_DEBUG("Encoding NativeInteger %s %ld (APER) (unsigned)", td->name, native);
-+		if(asn_long2INTEGER(&tmpint, native))
-+			_ASN_ENCODE_FAILED;
-+	}
-+
-+// 	if((specs&&specs->field_unsigned)
-+// 		? asn_ulong2INTEGER(&tmpint, native)
-+// 		: asn_long2INTEGER(&tmpint, native))
-+// 		_ASN_ENCODE_FAILED;
-+	er = INTEGER_encode_aper(td, constraints, &tmpint, po);
-+	ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);
-+	return er;
-+}
-+
- /*
-  * INTEGER specific human-readable output.
-  */
-Index: skeletons/constr_SEQUENCE.h
-===================================================================
---- skeletons/constr_SEQUENCE.h	(revision 1516)
-+++ skeletons/constr_SEQUENCE.h	(working copy)
-@@ -52,6 +52,8 @@
- xer_type_encoder_f SEQUENCE_encode_xer;
- per_type_decoder_f SEQUENCE_decode_uper;
- per_type_encoder_f SEQUENCE_encode_uper;
-+per_type_decoder_f SEQUENCE_decode_aper;
-+per_type_encoder_f SEQUENCE_encode_aper;
- 
- #ifdef __cplusplus
- }
-Index: skeletons/NativeInteger.h
-===================================================================
---- skeletons/NativeInteger.h	(revision 1516)
-+++ skeletons/NativeInteger.h	(working copy)
-@@ -29,6 +29,8 @@
- xer_type_encoder_f NativeInteger_encode_xer;
- per_type_decoder_f NativeInteger_decode_uper;
- per_type_encoder_f NativeInteger_encode_uper;
-+per_type_decoder_f NativeInteger_decode_aper;
-+per_type_encoder_f NativeInteger_encode_aper;
- 
- #ifdef __cplusplus
- }
-Index: skeletons/OCTET_STRING.h
-===================================================================
---- skeletons/OCTET_STRING.h	(revision 1516)
-+++ skeletons/OCTET_STRING.h	(working copy)
-@@ -32,6 +32,8 @@
- xer_type_encoder_f OCTET_STRING_encode_xer_utf8;
- per_type_decoder_f OCTET_STRING_decode_uper;
- per_type_encoder_f OCTET_STRING_encode_uper;
-+per_type_decoder_f OCTET_STRING_decode_aper;
-+per_type_encoder_f OCTET_STRING_encode_aper;
- 
- /******************************
-  * Handy conversion routines. *
-Index: skeletons/UTCTime.c
-===================================================================
---- skeletons/UTCTime.c	(revision 1516)
-+++ skeletons/UTCTime.c	(working copy)
-@@ -40,6 +40,8 @@
- 	UTCTime_encode_xer,
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_UTCTime_tags,
- 	sizeof(asn_DEF_UTCTime_tags)
-Index: skeletons/REAL.c
-===================================================================
---- skeletons/REAL.c	(revision 1516)
-+++ skeletons/REAL.c	(working copy)
-@@ -45,6 +45,8 @@
- 	REAL_encode_xer,
- 	REAL_decode_uper,
- 	REAL_encode_uper,
-+	REAL_decode_aper,
-+	REAL_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_REAL_tags,
- 	sizeof(asn_DEF_REAL_tags) / sizeof(asn_DEF_REAL_tags[0]),
-@@ -361,6 +363,21 @@
- 	return OCTET_STRING_encode_uper(td, 0, sptr, po);
- }
- 
-+asn_dec_rval_t
-+REAL_decode_aper(asn_codec_ctx_t *opt_codec_ctx,
-+	asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
-+	void **sptr, asn_per_data_t *pd) {
-+	(void)constraints;	/* No PER visible constraints */
-+	return OCTET_STRING_decode_aper(opt_codec_ctx, td, 0, sptr, pd);
-+}
-+
-+asn_enc_rval_t
-+REAL_encode_aper(asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-+	(void)constraints;	/* No PER visible constraints */
-+	return OCTET_STRING_encode_aper(td, 0, sptr, po);
-+}
-+
- int
- asn_REAL2double(const REAL_t *st, double *dbl_value) {
- 	unsigned int octv;
-Index: skeletons/VisibleString.c
-===================================================================
---- skeletons/VisibleString.c	(revision 1516)
-+++ skeletons/VisibleString.c	(working copy)
-@@ -29,6 +29,8 @@
- 	OCTET_STRING_encode_xer_utf8,
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_VisibleString_tags,
- 	sizeof(asn_DEF_VisibleString_tags)
-Index: skeletons/ANY.c
-===================================================================
---- skeletons/ANY.c	(revision 1516)
-+++ skeletons/ANY.c	(working copy)
-@@ -21,7 +21,10 @@
- 	OCTET_STRING_encode_der,
- 	OCTET_STRING_decode_xer_hex,
- 	ANY_encode_xer,
--	0, 0,
-+	OCTET_STRING_decode_uper,
-+	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	0, 0, 0, 0,
- 	0,	/* No PER visible constraints */
-@@ -87,6 +90,37 @@
- 	return 0;
- }
- 
-+int
-+ANY_fromType_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr) {
-+	uint8_t *buffer = NULL;
-+	ssize_t erval;
-+	
-+	if(!st || !td) {
-+		errno = EINVAL;
-+		return -1;
-+	}
-+	
-+	if(!sptr) {
-+		if(st->buf) FREEMEM(st->buf);
-+		st->size = 0;
-+		return 0;
-+	}
-+	
-+	erval = aper_encode_to_new_buffer(td, td->per_constraints, sptr, (void**)&buffer);
-+
-+	if(erval == -1) {
-+		if(buffer) FREEMEM(buffer);
-+		return -1;
-+	}
-+	assert((size_t)erval > 0);
-+	
-+	if(st->buf) FREEMEM(st->buf);
-+	st->buf = buffer;
-+	st->size = erval;
-+	
-+	return 0;
-+}
-+
- ANY_t *
- ANY_new_fromType(asn_TYPE_descriptor_t *td, void *sptr) {
- 	ANY_t tmp;
-@@ -111,6 +145,30 @@
- 	}
- }
- 
-+ANY_t *
-+ANY_new_fromType_aper(asn_TYPE_descriptor_t *td, void *sptr) {
-+	ANY_t tmp;
-+	ANY_t *st;
-+	
-+	if(!td || !sptr) {
-+		errno = EINVAL;
-+		return 0;
-+	}
-+	
-+	memset(&tmp, 0, sizeof(tmp));
-+	
-+	if(ANY_fromType_aper(&tmp, td, sptr)) return 0;
-+	
-+	st = (ANY_t *)CALLOC(1, sizeof(ANY_t));
-+	if(st) {
-+		*st = tmp;
-+		return st;
-+	} else {
-+		FREEMEM(tmp.buf);
-+		return 0;
-+	}
-+}
-+
- int
- ANY_to_type(ANY_t *st, asn_TYPE_descriptor_t *td, void **struct_ptr) {
- 	asn_dec_rval_t rval;
-@@ -138,6 +196,33 @@
- 	}
- }
- 
-+int
-+ANY_to_type_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void **struct_ptr) {
-+	asn_dec_rval_t rval;
-+	void *newst = 0;
-+	
-+	if(!st || !td || !struct_ptr) {
-+		errno = EINVAL;
-+		return -1;
-+	}
-+	
-+	if(st->buf == 0) {
-+		/* Nothing to convert, make it empty. */
-+		*struct_ptr = (void *)0;
-+		return 0;
-+	}
-+	
-+	rval = aper_decode(0, td, (void **)&newst, st->buf, st->size, 0, 0);
-+	if(rval.code == RC_OK) {
-+		*struct_ptr = newst;
-+		return 0;
-+	} else {
-+		/* Remove possibly partially decoded data. */
-+		ASN_STRUCT_FREE(*td, newst);
-+		return -1;
-+	}
-+}
-+
- static int ANY__consume_bytes(const void *buffer, size_t size, void *key) {
- 	struct _callback_arg *arg = (struct _callback_arg *)key;
- 
-Index: skeletons/REAL.h
-===================================================================
---- skeletons/REAL.h	(revision 1516)
-+++ skeletons/REAL.h	(working copy)
-@@ -21,6 +21,8 @@
- xer_type_encoder_f REAL_encode_xer;
- per_type_decoder_f REAL_decode_uper;
- per_type_encoder_f REAL_encode_uper;
-+per_type_decoder_f REAL_decode_aper;
-+per_type_encoder_f REAL_encode_aper;
- 
- /***********************************
-  * Some handy conversion routines. *
-Index: skeletons/NativeReal.c
-===================================================================
---- skeletons/NativeReal.c	(revision 1516)
-+++ skeletons/NativeReal.c	(working copy)
-@@ -32,6 +32,8 @@
- 	NativeReal_encode_xer,
- 	NativeReal_decode_uper,
- 	NativeReal_encode_uper,
-+	NativeReal_decode_aper,
-+	NativeReal_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_NativeReal_tags,
- 	sizeof(asn_DEF_NativeReal_tags) / sizeof(asn_DEF_NativeReal_tags[0]),
-@@ -123,11 +125,11 @@
- 			tmp.size = length;
- 			memcpy(tmp.buf, buf_ptr, length);
- 			tmp.buf[tmp.size] = '\0';
--			if(asn_REAL2double(&tmp, &d)) {
--				rval.code = RC_FAIL;
--				rval.consumed = 0;
--				return rval;
--			}
-+		if(asn_REAL2double(&tmp, &d)) {
-+			rval.code = RC_FAIL;
-+			rval.consumed = 0;
-+			return rval;
-+		}
- 		} else {
- 			/* This should probably never happen: impractically long value */
- 			tmp.buf = CALLOC(1, length + 1);
-@@ -228,6 +230,43 @@
- 	return rval;
- }
- 
-+asn_dec_rval_t
-+NativeReal_decode_aper(asn_codec_ctx_t *opt_codec_ctx,
-+	asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
-+		void **dbl_ptr, asn_per_data_t *pd) {
-+	double *Dbl = (double *)*dbl_ptr;
-+	asn_dec_rval_t rval;
-+	REAL_t tmp;
-+	void *ptmp = &tmp;
-+	int ret;
-+
-+	(void)constraints;
-+
-+	/*
-+	 * If the structure is not there, allocate it.
-+	 */
-+	if(Dbl == NULL) {
-+		*dbl_ptr = CALLOC(1, sizeof(*Dbl));
-+		Dbl = (double *)*dbl_ptr;
-+		if(Dbl == NULL)
-+			_ASN_DECODE_FAILED;
-+	}
-+
-+	memset(&tmp, 0, sizeof(tmp));
-+	rval = OCTET_STRING_decode_aper(opt_codec_ctx, td, NULL,
-+			&ptmp, pd);
-+	if(rval.code != RC_OK) {
-+		ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_REAL, &tmp);
-+		return rval;
-+	}
-+
-+	ret = asn_REAL2double(&tmp, Dbl);
-+	ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_REAL, &tmp);
-+	if(ret) _ASN_DECODE_FAILED;
-+
-+	return rval;
-+}
-+
- /*
-  * Encode the NativeReal using the OCTET STRING PER encoder.
-  */
-@@ -257,6 +296,32 @@
- 	return erval;
- }
- 
-+asn_enc_rval_t
-+NativeReal_encode_aper(asn_TYPE_descriptor_t *td,
-+	asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
-+	double Dbl = *(const double *)sptr;
-+	asn_enc_rval_t erval;
-+	REAL_t tmp;
-+
-+	(void)constraints;
-+
-+	/* Prepare a temporary clean structure */
-+	memset(&tmp, 0, sizeof(tmp));
-+
-+	if(asn_double2REAL(&tmp, Dbl))
-+		_ASN_ENCODE_FAILED;
-+
-+	/* Encode a DER REAL */
-+	erval = OCTET_STRING_encode_aper(td, NULL, &tmp, po);
-+	if(erval.encoded == -1)
-+		erval.structure_ptr = sptr;
-+
-+	/* Free possibly allocated members of the temporary structure */
-+	ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_REAL, &tmp);
-+
-+	return erval;
-+}
-+
- /*
-  * Decode the chunk of XML text encoding REAL.
-  */
-Index: skeletons/asn_system.h
-===================================================================
---- skeletons/asn_system.h	(revision 1516)
-+++ skeletons/asn_system.h	(working copy)
-@@ -21,6 +21,11 @@
- #include <stdarg.h>	/* For va_start */
- #include <stddef.h>	/* for offsetof and ptrdiff_t */
- 
-+#if HAVE_STDINT_H
-+# include <stdint.h>
-+# include <inttypes.h>
-+#endif
-+
- #ifdef	_WIN32
- 
- #include <malloc.h>
-Index: skeletons/ANY.h
-===================================================================
---- skeletons/ANY.h	(revision 1516)
-+++ skeletons/ANY.h	(working copy)
-@@ -32,10 +32,13 @@
- 
- /* Convert another ASN.1 type into the ANY. This implies DER encoding. */
- int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr);
-+int ANY_fromType_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr);
- ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr);
-+ANY_t *ANY_new_fromType_aper(asn_TYPE_descriptor_t *td, void *sptr);
- 
- /* Convert the contents of the ANY type into the specified type. */
- int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
-+int ANY_to_type_aper(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
- 
- #define	ANY_fromBuf(s, buf, size)	OCTET_STRING_fromBuf((s), (buf), (size))
- #define	ANY_new_fromBuf(buf, size)	OCTET_STRING_new_fromBuf(	\
-Index: skeletons/NativeReal.h
-===================================================================
---- skeletons/NativeReal.h	(revision 1516)
-+++ skeletons/NativeReal.h	(working copy)
-@@ -27,6 +27,8 @@
- xer_type_encoder_f NativeReal_encode_xer;
- per_type_decoder_f NativeReal_decode_uper;
- per_type_encoder_f NativeReal_encode_uper;
-+per_type_decoder_f NativeReal_decode_aper;
-+per_type_encoder_f NativeReal_encode_aper;
- 
- #ifdef __cplusplus
- }
-Index: skeletons/UniversalString.c
-===================================================================
---- skeletons/UniversalString.c	(revision 1516)
-+++ skeletons/UniversalString.c	(working copy)
-@@ -35,6 +35,8 @@
- 	UniversalString_encode_xer,	/* Convert into UTF-8 */
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_UniversalString_tags,
- 	sizeof(asn_DEF_UniversalString_tags)
-Index: skeletons/GraphicString.c
-===================================================================
---- skeletons/GraphicString.c	(revision 1516)
-+++ skeletons/GraphicString.c	(working copy)
-@@ -24,6 +24,8 @@
- 	OCTET_STRING_encode_xer,	/* Can't expect it to be ASCII/UTF8 */
- 	OCTET_STRING_decode_uper,    /* Implemented in terms of OCTET STRING */
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_GraphicString_tags,
- 	sizeof(asn_DEF_GraphicString_tags)
-Index: skeletons/GeneralizedTime.c
-===================================================================
---- skeletons/GeneralizedTime.c	(revision 1516)
-+++ skeletons/GeneralizedTime.c	(working copy)
-@@ -167,6 +167,8 @@
- 	GeneralizedTime_encode_xer,
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
-+	OCTET_STRING_decode_aper,
-+	OCTET_STRING_encode_aper,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_GeneralizedTime_tags,
- 	sizeof(asn_DEF_GeneralizedTime_tags)
-Index: libasn1compiler/asn1c_out.h
-===================================================================
---- libasn1compiler/asn1c_out.h	(revision 1516)
-+++ libasn1compiler/asn1c_out.h	(working copy)
-@@ -117,16 +117,24 @@
-  * Format LONG_MIN according to C90 rules.
-  */
- #define OINT(iv)	do {					\
--	if(iv == (-2147483647L - 1))				\
-+	if(iv > 4294967295U)						\
-+		OUT("%" PRIdASN"ULL", iv);			\
-+	else if(iv > 2147483647L)				\
-+		OUT("%" PRIdASN"U", iv);				\
-+	else if(iv == (-2147483647L - 1))		\
- 		OUT("(-2147483647L - 1)");			\
--	else							\
-+	else									\
- 		OUT("%" PRIdASN, iv);				\
- } while(0)
- 
- #define OINTS(iv)	do {					\
--	if(iv == (-2147483647L - 1))				\
-+	if(iv > 4294967295U)						\
-+		OUT("%" PRIdASN"ULL", iv);			\
-+	else if(iv > 2147483647L)				\
-+		OUT("%" PRIdASN"U", iv);				\
-+	else if(iv == (-2147483647L - 1))		\
- 		OUT("(-2147483647L - 1)");			\
--	else							\
-+	else									\
- 		OUT("% " PRIdASN, iv);				\
- } while(0)
- 
-Index: libasn1compiler/asn1compiler.h
-===================================================================
---- libasn1compiler/asn1compiler.h	(revision 1516)
-+++ libasn1compiler/asn1compiler.h	(working copy)
-@@ -77,7 +77,14 @@
- 	 * -fline-refs
- 	 * Include ASN.1 module's line numbers in comments.
- 	 */
--	A1C_LINE_REFS       = 0x20000
-+	A1C_LINE_REFS       = 0x20000,
-+ 	/*
-+	 * -fhave_native64
-+	 * Assume target platform has native 64bits support and generate types using
-+	 * int64_t or uint64_t whereas possible
-+	 */
-+	A1C_HAVE_NATIVE_64	= 0x40000
-+
- };
- 
- /*
-Index: libasn1compiler/asn1c_C.c
-===================================================================
---- libasn1compiler/asn1c_C.c	(revision 1516)
-+++ libasn1compiler/asn1c_C.c	(working copy)
-@@ -1242,6 +1242,8 @@
- 	OUT("td->xer_encoder    = asn_DEF_%s.xer_encoder;\n",    type_name);
- 	OUT("td->uper_decoder   = asn_DEF_%s.uper_decoder;\n",   type_name);
- 	OUT("td->uper_encoder   = asn_DEF_%s.uper_encoder;\n",   type_name);
-+	OUT("td->aper_decoder   = asn_DEF_%s.aper_decoder;\n",   type_name);
-+	OUT("td->aper_encoder   = asn_DEF_%s.aper_encoder;\n",   type_name);
- 	if(!terminal && !tags_count) {
- 	  OUT("/* The next four lines are here because of -fknown-extern-type */\n");
- 	  OUT("td->tags           = asn_DEF_%s.tags;\n",         type_name);
-@@ -1394,6 +1396,38 @@
- 	);
- 	OUT("}\n");
- 	OUT("\n");
-+
-+	p = MKID(expr);
-+	if(HIDE_INNER_DEFS) OUT("static ");
-+							OUT("asn_enc_rval_t\n");
-+	OUT("%s", p);
-+	if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index);
-+		OUT("_encode_aper(asn_TYPE_descriptor_t *td,\n");
-+	INDENTED(
-+	OUT("\tasn_per_constraints_t *constraints,\n");
-+	OUT("\tvoid *structure, asn_per_outp_t *per_out) {\n");
-+	OUT("%s_%d_inherit_TYPE_descriptor(td);\n",
-+		p, expr->_type_unique_index);
-+	OUT("return td->aper_encoder(td, constraints, structure, per_out);\n");
-+	);
-+	OUT("}\n");
-+	OUT("\n");
-+
-+	p = MKID(expr);
-+	
-+	if(HIDE_INNER_DEFS) OUT("static ");
-+	OUT("asn_dec_rval_t\n");
-+	OUT("%s", p);
-+	if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index);
-+	OUT("_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,\n");
-+	INDENTED(
-+		OUT("\tasn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) {\n");
-+	OUT("%s_%d_inherit_TYPE_descriptor(td);\n",
-+		p, expr->_type_unique_index);
-+	OUT("return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data);\n");
-+	);
-+	OUT("}\n");
-+	OUT("\n");
-   }
- 
- 	REDIR(OT_FUNC_DECLS);
-@@ -1415,6 +1449,8 @@
- 		if(arg->flags & A1C_GEN_PER) {
- 		OUT("per_type_decoder_f %s_decode_uper;\n", p);
- 		OUT("per_type_encoder_f %s_encode_uper;\n", p);
-+		OUT("per_type_decoder_f %s_decode_aper;\n", p);
-+		OUT("per_type_encoder_f %s_encode_aper;\n", p);
- 		}
- 	}
- 
-@@ -1670,12 +1706,11 @@
- 		OUT("%d, ", tag2el[i].el_no);
- 		OUT("%d, ", tag2el[i].toff_first);
- 		OUT("%d ", tag2el[i].toff_last);
--		OUT("}%s /* %s",
-+		OUT("}%s /* %s at %d */\n",
- 			(i + 1 < tag2el_count) ? "," : "",
--			tag2el[i].from_expr->Identifier);
--        if(arg->flags & A1C_LINE_REFS)
--            OUT("at %d", tag2el[i].from_expr->_lineno);
--        OUT(" */\n");
-+			tag2el[i].from_expr->Identifier,
-+			tag2el[i].from_expr->_lineno
-+		);
- 	}
- 	OUT("};\n");
- 
-@@ -2111,19 +2146,22 @@
- try_inline_default(arg_t *arg, asn1p_expr_t *expr, int out) {
- 	int save_target = arg->target->target;
- 	asn1p_expr_type_e etype = expr_get_type(arg, expr);
--	int fits_long = 0;
-+// 	int fits_long = 0;
-+	enum asn1c_fitslong_e fits = FL_NOTFIT;
- 
- 	switch(etype) {
- 	case ASN_BASIC_BOOLEAN:
--		fits_long = 1;
-+// 		fits_long = 1;
-+		fits = FL_FITS_SIGNED;
- 	case ASN_BASIC_INTEGER:
- 	case ASN_BASIC_ENUMERATED:
- 		if(expr->marker.default_value == NULL
- 		|| expr->marker.default_value->type != ATV_INTEGER)
- 			break;
--		if(!fits_long)
--			fits_long = asn1c_type_fits_long(arg, expr)!=FL_NOTFIT;
--		if(fits_long && !expr->marker.default_value->value.v_integer)
-+		if(fits == FL_NOTFIT)
-+// 			fits_long = asn1c_type_fits_long(arg, expr)!=FL_NOTFIT;
-+			fits = asn1c_type_fits_long(arg, expr);
-+		if(fits != FL_NOTFIT && !expr->marker.default_value->value.v_integer)
- 			expr->marker.flags &= ~EM_INDIRECT;
- 		if(!out) {
- 			OUT("asn_DFL_%d_set_%" PRIdASN
-@@ -2150,7 +2188,7 @@
- 		INDENT(+1);
- 		OUT("/* Install default value %" PRIdASN " */\n",
- 			expr->marker.default_value->value.v_integer);
--		if(fits_long) {
-+		if(fits != FL_NOTFIT) {
- 			OUT("*st = ");
- 			OINT(expr->marker.default_value->value.v_integer);
- 			OUT(";\n");
-@@ -2165,7 +2203,7 @@
- 		INDENT(+1);
- 		OUT("/* Test default value %" PRIdASN " */\n",
- 			expr->marker.default_value->value.v_integer);
--		if(fits_long) {
-+		if(fits != FL_NOTFIT) {
- 			OUT("return (*st == %" PRIdASN ");\n",
- 				expr->marker.default_value->value.v_integer);
- 		} else {
-@@ -2455,9 +2493,13 @@
- 		if(arg->flags & A1C_GEN_PER) {
- 			FUNCREF(decode_uper);
- 			FUNCREF(encode_uper);
-+			FUNCREF(decode_aper);
-+			FUNCREF(encode_aper);
- 		} else {
--			OUT("0, 0,\t/* No PER support, "
-+			OUT("0, 0,\t/* No UPER support, "
- 				"use \"-gen-PER\" to enable */\n");
-+			OUT("0, 0,\t/* No APER support, "
-+				"use \"-gen-PER\" to enable */\n");
- 		}
- 
- 		if(!terminal || terminal->expr_type == ASN_CONSTR_CHOICE) {
-Index: libasn1compiler/asn1c_constraint.c
-===================================================================
---- libasn1compiler/asn1c_constraint.c	(revision 1516)
-+++ libasn1compiler/asn1c_constraint.c	(working copy)
-@@ -35,6 +35,7 @@
- 	int alphabet_table_compiled;
- 	int produce_st = 0;
- 	int ulong_optimize = 0;
-+	enum asn1c_fitslong_e fits = FL_NOTFIT;
- 
- 	ct = expr->combined_constraints;
- 	if(ct == NULL)
-@@ -74,7 +75,8 @@
- 	switch(etype) {
- 	case ASN_BASIC_INTEGER:
- 	case ASN_BASIC_ENUMERATED:
--		if(asn1c_type_fits_long(arg, arg->expr) == FL_NOTFIT)
-+		fits = asn1c_type_fits_long(arg, arg->expr);
-+		if(fits == FL_NOTFIT)
- 			produce_st = 1;
- 		break;
- 	case ASN_BASIC_REAL:
-@@ -103,13 +105,19 @@
- 			switch(etype) {
- 			case ASN_BASIC_INTEGER:
- 			case ASN_BASIC_ENUMERATED:
--				if(native_long_sign(r_value) >= 0) {
--					ulong_optimize = ulong_optimization(etype, r_size, r_value);
--					if(!ulong_optimize) {
--						OUT("unsigned long value;\n");
-+				if(fits == FL_FITS_INT64) {
-+					OUT("int64_t value;\n");
-+				} else if(fits == FL_FITS_UINT64) {
-+					OUT("uint64_t value;\n");
-+				} else {
-+					if(native_long_sign(r_value) >= 0) {
-+						ulong_optimize = ulong_optimization(etype, r_size, r_value);
-+						if(!ulong_optimize) {
-+							OUT("unsigned long value;\n");
-+						}
-+					} else {
-+						OUT("long value;\n");
- 					}
--				} else {
--					OUT("long value;\n");
- 				}
- 				break;
- 			case ASN_BASIC_REAL:
-@@ -603,13 +611,19 @@
- 
- static int
- emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype, asn1cnst_range_t *r_value) {
-+	enum asn1c_fitslong_e fits = FL_NOTFIT;
- 
- 	switch(etype) {
- 	case ASN_BASIC_INTEGER:
- 	case ASN_BASIC_ENUMERATED:
--		if(asn1c_type_fits_long(arg, arg->expr) == FL_FITS_UNSIGN) {
-+		fits = asn1c_type_fits_long(arg, arg->expr);
-+		if(fits == FL_FITS_INT64) {
-+			OUT("value = *(const int64_t *)sptr;\n");
-+		} else if(fits == FL_FITS_UINT64) {
-+			OUT("value = *(const uint64_t *)sptr;\n");
-+		} else if(fits == FL_FITS_UNSIGN) {
- 			OUT("value = *(const unsigned long *)sptr;\n");
--		} else if(asn1c_type_fits_long(arg, arg->expr) != FL_NOTFIT) {
-+		} else if(fits != FL_NOTFIT) {
- 			OUT("value = *(const long *)sptr;\n");
- 		} else {
- 			/*
-Index: libasn1compiler/asn1c_misc.c
-===================================================================
---- libasn1compiler/asn1c_misc.c	(revision 1516)
-+++ libasn1compiler/asn1c_misc.c	(working copy)
-@@ -158,6 +158,7 @@
- 	asn1p_expr_t *terminal;
- 	int stdname = 0;
- 	char *typename;
-+	enum asn1c_fitslong_e fits;
- 
- 	/* Rewind to the topmost parent expression */
- 	if((top_parent = expr->parent_expr))
-@@ -213,15 +214,20 @@
- 	case ASN_BASIC_INTEGER:
- 	case ASN_BASIC_ENUMERATED:
- 	case ASN_BASIC_REAL:
-+		fits = asn1c_type_fits_long(arg, expr);
- 		if((expr->expr_type == ASN_BASIC_REAL
- 			&& !(arg->flags & A1C_USE_WIDE_TYPES))
--		|| asn1c_type_fits_long(arg, expr)) {
-+			|| (fits != FL_NOTFIT)) {
- 			switch(_format) {
- 			case TNF_CTYPE:
- 			case TNF_RSAFE:
- 				if(expr->expr_type == ASN_BASIC_REAL)
- 					return "double";
--				else if(asn1c_type_fits_long(arg, expr) == FL_FITS_UNSIGN)
-+				else if (fits == FL_FITS_INT64)
-+					return "int64_t";
-+				else if (fits == FL_FITS_UINT64)
-+					return "uint64_t";
-+				else if(fits == FL_FITS_UNSIGN)
- 					return "unsigned long";
- 				else
- 					return "long";
-@@ -377,11 +383,33 @@
- 	/* Special case for unsigned */
- 	if(left.type == ARE_VALUE
- 		&& left.value >= 0
--	&& right.type == ARE_VALUE
-+		&& right.type == ARE_VALUE
- 		&& right.value > 2147483647
- 		&& right.value <= 4294967295UL)
- 		return FL_FITS_UNSIGN;
--		
-+	/* Special for native 64 bits integer option */
-+	if (arg->flags & A1C_HAVE_NATIVE_64) {
-+// 		printf("left.value %lld right.value %lld\n", left.value, right.value);
-+		if(left.type == ARE_VALUE
-+			&& left.value >= 0
-+			&& right.type == ARE_VALUE
-+			&& right.value > 9223372036854775807LL
-+			&& right.value <= 18446744073709551615ULL)
-+			return FL_FITS_UINT64;
-+		if(left.type == ARE_VALUE
-+			&& left.value < -2147483648
-+			&& left.value >= -9223372036854775808LL
-+			&& right.type == ARE_VALUE
-+			&& right.value > 2147483647
-+			&& right.value <= 9223372036854775807LL)
-+			return FL_FITS_INT64;
-+		if(left.type == ARE_VALUE
-+			&& left.value >= 0
-+			&& right.type == ARE_VALUE
-+			&& right.value > 4294967295UL
-+			&& right.value <= 9223372036854775807LL)
-+			return FL_FITS_INT64;
-+	}
- 
- 	/* If some fixed value is outside of target range, not fit */
- 	if(left.type == ARE_VALUE
-Index: libasn1compiler/asn1c_misc.h
-===================================================================
---- libasn1compiler/asn1c_misc.h	(revision 1516)
-+++ libasn1compiler/asn1c_misc.h	(working copy)
-@@ -36,6 +36,8 @@
-  */
- enum asn1c_fitslong_e {
- 	FL_NOTFIT,
-+	FL_FITS_INT64,
-+	FL_FITS_UINT64,
- 	FL_FITS_SIGNED,
- 	FL_FITS_UNSIGN,
- 	FL_PRESUMED,
diff --git a/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_2.p0 b/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_2.p0
deleted file mode 100644
index 80835b1b86621a62fde0dda589135082c142ed93..0000000000000000000000000000000000000000
--- a/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_2.p0
+++ /dev/null
@@ -1,22 +0,0 @@
---- skeletons/OCTET_STRING.c.orig	2015-04-28 10:40:04.036970492 +0200
-+++ skeletons/OCTET_STRING.c	2015-04-28 10:40:09.619970869 +0200
-@@ -159,7 +159,7 @@
- }
- 
- static struct _stack *
--_new_stack() {
-+_new_stack(void) {
- 	return (struct _stack *)CALLOC(1, sizeof(struct _stack));
- }
- 
---- skeletons/converter-sample.c.orig	2015-04-28 10:40:32.164972391 +0200
-+++ skeletons/converter-sample.c	2015-04-28 10:40:37.140972727 +0200
-@@ -353,7 +353,7 @@
- } DynamicBuffer;
- 
- static void
--buffer_dump() {
-+buffer_dump(void) {
- 	uint8_t *p = DynamicBuffer.data + DynamicBuffer.offset;
- 	uint8_t *e = p + DynamicBuffer.length - (DynamicBuffer.unbits ? 1 : 0);
- 	if(!opt_debug) return;
diff --git a/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_3.p0 b/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_3.p0
deleted file mode 100644
index d5a936c1018b9d3bcc96d06d532c3cddbec911d4..0000000000000000000000000000000000000000
--- a/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_3.p0
+++ /dev/null
@@ -1,1264 +0,0 @@
---- asn1c/unber.c	2015-12-08 14:39:33.282543533 +0100
-+++ asn1c/unber.c	2015-12-07 10:46:18.382647000 +0100
-@@ -779,4 +779,6 @@
- 
- asn_enc_rval_t OCTET_STRING_encode_aper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts, void *sptr, asn_per_outp_t *po) { asn_enc_rval_t er = { 0, 0, 0 }; (void)td; (void)cts; (void)sptr; (void)po; return er; }
- 
-+asn_comp_rval_t *  OCTET_STRING_compare(asn_TYPE_descriptor_t *td1, const void *sptr1, asn_TYPE_descriptor_t *td2, const void *sptr2) { (void)td1; (void)sptr1; (void)td2; (void)sptr2; return 0; }
-+
- size_t xer_whitespace_span(const void *chunk_buf, size_t chunk_size) {  (void)chunk_buf; (void)chunk_size; return 0; }
---- libasn1compiler/asn1c_C.c	2015-12-08 14:39:33.366543533 +0100
-+++ libasn1compiler/asn1c_C.c	2015-12-08 08:38:29.002565000 +0100
-@@ -1082,6 +1082,8 @@
- 	enum tvm_compat tv_mode;
- 	enum etd_spec etd_spec;
- 	char *p;
-+  //char tmp_buf[512];
-+  //int i = 0;
- 
- 	if(arg->embed) {
- 		enum tnfmt tnfmt = TNF_CTYPE;
-@@ -1243,7 +1245,8 @@
- 	OUT("td->uper_decoder   = asn_DEF_%s.uper_decoder;\n",   type_name);
- 	OUT("td->uper_encoder   = asn_DEF_%s.uper_encoder;\n",   type_name);
- 	OUT("td->aper_decoder   = asn_DEF_%s.aper_decoder;\n",   type_name);
--	OUT("td->aper_encoder   = asn_DEF_%s.aper_encoder;\n",   type_name);
-+  OUT("td->aper_encoder   = asn_DEF_%s.aper_encoder;\n",   type_name);
-+  OUT("td->compare        = asn_DEF_%s.compare;\n",        type_name);
- 	if(!terminal && !tags_count) {
- 	  OUT("/* The next four lines are here because of -fknown-extern-type */\n");
- 	  OUT("td->tags           = asn_DEF_%s.tags;\n",         type_name);
-@@ -1413,6 +1416,39 @@
- 	OUT("}\n");
- 	OUT("\n");
- 
-+
-+  //i = 0;
-+  //while ((p[i] != '_') && (i < sizeof(tmp_buf))) {
-+  //  tmp_buf[i] = p[i];
-+  //  i++;
-+  //}
-+  //tmp_buf[i] = '\0';
-+  // hack, only for s1ap
-+  //if ((strcmp("S1ap", tmp_buf) == 0) || (strcmp("X2ap", tmp_buf) == 0))
-+  //  OUT("#include \"%s-ProtocolIE-ID.h\"\n", tmp_buf);
-+
-+
-+  p = MKID(expr);
-+  if(HIDE_INNER_DEFS) OUT("static ");
-+              OUT("asn_comp_rval_t * \n");
-+  OUT("%s", p);
-+  if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index);
-+    OUT("_compare(asn_TYPE_descriptor_t *td1,\n");
-+  INDENTED(
-+  OUT("\tconst void *structure1,\n");
-+  OUT("\tasn_TYPE_descriptor_t *td2,\n");
-+  OUT("\tconst void *structure2) {\n");
-+  OUT("asn_comp_rval_t * res  = NULL;\n");
-+  OUT("%s_%d_inherit_TYPE_descriptor(td1);\n",
-+    p, expr->_type_unique_index);
-+  OUT("%s_%d_inherit_TYPE_descriptor(td2);\n",
-+    p, expr->_type_unique_index);
-+  OUT("res = td1->compare(td1, structure1, td2, structure2);\n");
-+  OUT("return res;\n");
-+  );
-+  OUT("}\n");
-+  OUT("\n");
-+
- 	p = MKID(expr);
- 	
- 	if(HIDE_INNER_DEFS) OUT("static ");
-@@ -1450,7 +1486,8 @@
- 		OUT("per_type_decoder_f %s_decode_uper;\n", p);
- 		OUT("per_type_encoder_f %s_encode_uper;\n", p);
- 		OUT("per_type_decoder_f %s_decode_aper;\n", p);
--		OUT("per_type_encoder_f %s_encode_aper;\n", p);
-+    OUT("per_type_encoder_f %s_encode_aper;\n", p);
-+    OUT("type_compare_f     %s_compare;\n", p);
- 		}
- 	}
- 
-@@ -2501,6 +2538,7 @@
- 			OUT("0, 0,\t/* No APER support, "
- 				"use \"-gen-PER\" to enable */\n");
- 		}
-+    FUNCREF(compare);
- 
- 		if(!terminal || terminal->expr_type == ASN_CONSTR_CHOICE) {
- 		//if(expr->expr_type == ASN_CONSTR_CHOICE) {
---- skeletons/ANY.c	2015-12-08 14:39:33.350543533 +0100
-+++ skeletons/ANY.c	2015-11-26 14:40:56.547616000 +0100
-@@ -24,7 +24,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	0, 0, 0, 0,
- 	0,	/* No PER visible constraints */
---- skeletons/asn_application.h	2015-12-08 14:39:12.674543554 +0100
-+++ skeletons/asn_application.h	2015-12-07 14:36:32.950633000 +0100
-@@ -9,7 +9,8 @@
- #define	_ASN_APPLICATION_H_
- 
- #include "asn_system.h"		/* for platform-dependent types */
--#include "asn_codecs.h"		/* for ASN.1 codecs specifics */
-+#include "asn_codecs.h"   /* for ASN.1 codecs specifics */
-+#include "asn_compare.h"
- 
- #ifdef __cplusplus
- extern "C" {
---- skeletons/asn_compare.h	1970-01-01 01:00:00.000000000 +0100
-+++ skeletons/asn_compare.h	2015-12-08 10:34:58.090558000 +0100
-@@ -0,0 +1,78 @@
-+#ifndef	_ASN_COMPARE_H_
-+#define	_ASN_COMPARE_H_
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+struct asn_TYPE_descriptor_s;	/* Forward declaration */
-+
-+
-+typedef enum COMPARE_ERR_CODE_e {
-+  COMPARE_ERR_CODE_START = 0,
-+  COMPARE_ERR_CODE_NONE = COMPARE_ERR_CODE_START,
-+  COMPARE_ERR_CODE_NO_MATCH,
-+  COMPARE_ERR_CODE_TYPE_MISMATCH,
-+  COMPARE_ERR_CODE_TYPE_ARG_NULL,
-+  COMPARE_ERR_CODE_VALUE_NULL,
-+  COMPARE_ERR_CODE_VALUE_ARG_NULL,
-+  COMPARE_ERR_CODE_CHOICE_NUM,
-+  COMPARE_ERR_CODE_CHOICE_PRESENT,
-+  COMPARE_ERR_CODE_CHOICE_MALFORMED,
-+  COMPARE_ERR_CODE_SET_MALFORMED,
-+  COMPARE_ERR_CODE_COLLECTION_NUM_ELEMENTS,
-+  COMPARE_ERR_CODE_END
-+} COMPARE_ERR_CODE_t;
-+
-+typedef struct asn_comp_rval_s {
-+  enum COMPARE_ERR_CODE_e err_code;
-+  char                   *name; // e_S1ap_ProtocolIE_ID not available for all ASN1 use (RRC vs S1AP, X2AP)
-+  const void             *structure1;
-+  const void             *structure2;
-+  struct asn_comp_rval_s *next;
-+} asn_comp_rval_t;
-+
-+#define COMPARE_CHECK_ARGS(aRg_tYpE_dEf1, aRg_tYpE_dEf2, aRg_vAl1, aRg_vAl2, rEsUlT) \
-+    do {\
-+      if ((aRg_tYpE_dEf1) && (aRg_tYpE_dEf2)) {\
-+        if ((aRg_tYpE_dEf1->name) && (aRg_tYpE_dEf2->name)) {\
-+          if (strcmp(aRg_tYpE_dEf1->name, aRg_tYpE_dEf2->name)) {\
-+            rEsUlT           = (asn_comp_rval_t *)calloc(1, sizeof(asn_comp_rval_t));\
-+            rEsUlT->err_code = COMPARE_ERR_CODE_TYPE_MISMATCH;\
-+            rEsUlT->name     = aRg_tYpE_dEf1->name;\
-+            return rEsUlT;\
-+          }\
-+        } else {\
-+          if ((aRg_tYpE_dEf1->xml_tag) && (aRg_tYpE_dEf2->xml_tag)) {\
-+            if (strcmp(aRg_tYpE_dEf1->xml_tag, aRg_tYpE_dEf2->xml_tag)) {\
-+              rEsUlT           = (asn_comp_rval_t *)calloc(1, sizeof(asn_comp_rval_t));\
-+              rEsUlT->err_code = COMPARE_ERR_CODE_TYPE_MISMATCH;\
-+              rEsUlT->name     = aRg_tYpE_dEf1->xml_tag;\
-+              return rEsUlT;\
-+            }\
-+          }\
-+        }\
-+      } else {\
-+        rEsUlT             = (asn_comp_rval_t *)calloc(1, sizeof(asn_comp_rval_t));\
-+        rEsUlT->name       = aRg_tYpE_dEf1->name;\
-+        rEsUlT->structure1 = aRg_vAl1;\
-+        rEsUlT->structure2 = aRg_vAl2;\
-+        rEsUlT->err_code   = COMPARE_ERR_CODE_TYPE_ARG_NULL;\
-+        return rEsUlT;\
-+      }\
-+      if ((NULL == aRg_vAl1) || (NULL == aRg_vAl2)){\
-+        rEsUlT             = (asn_comp_rval_t *)calloc(1, sizeof(asn_comp_rval_t));\
-+        rEsUlT->name       = aRg_tYpE_dEf1->name;\
-+        rEsUlT->structure1 = aRg_vAl1;\
-+        rEsUlT->structure2 = aRg_vAl2;\
-+        rEsUlT->err_code   = COMPARE_ERR_CODE_VALUE_ARG_NULL;\
-+        return rEsUlT;\
-+      }\
-+    } while (0);
-+
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+#endif	/* _ASN_COMPARE_H_ */
---- skeletons/BIT_STRING.c	2015-12-08 14:39:33.346543533 +0100
-+++ skeletons/BIT_STRING.c	2015-11-26 14:41:50.159616000 +0100
-@@ -30,7 +30,8 @@
- 	OCTET_STRING_decode_uper,	/* Unaligned PER decoder */
- 	OCTET_STRING_encode_uper,	/* Unaligned PER encoder */
- 	OCTET_STRING_decode_aper,	/* Aligned PER decoder */
--	OCTET_STRING_encode_aper,	/* Aligned PER encoder */
-+  OCTET_STRING_encode_aper, /* Aligned PER encoder */
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_BIT_STRING_tags,
- 	sizeof(asn_DEF_BIT_STRING_tags)
---- skeletons/BMPString.c	2015-12-08 14:39:33.338543533 +0100
-+++ skeletons/BMPString.c	2015-11-26 14:42:08.487616000 +0100
-@@ -36,7 +36,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,	/* Aligned PER decoder */
--	OCTET_STRING_encode_aper,	/* Aligned PER encoder */
-+  OCTET_STRING_encode_aper, /* Aligned PER encoder */
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_BMPString_tags,
- 	sizeof(asn_DEF_BMPString_tags)
---- skeletons/BOOLEAN.c	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/BOOLEAN.c	2015-12-08 10:37:11.866558000 +0100
-@@ -25,7 +25,8 @@
- 	BOOLEAN_decode_uper,	/* Unaligned PER decoder */
- 	BOOLEAN_encode_uper,	/* Unaligned PER encoder */
- 	BOOLEAN_decode_aper,	/* Aligned PER decoder */
--	BOOLEAN_encode_aper,	/* Aligned PER encoder */
-+  BOOLEAN_encode_aper,  /* Aligned PER encoder */
-+  BOOLEAN_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_BOOLEAN_tags,
- 	sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]),
-@@ -326,3 +327,22 @@
- 
- 	_ASN_ENCODED_OK(er);
- }
-+
-+asn_comp_rval_t *
-+BOOLEAN_compare(asn_TYPE_descriptor_t *td1,
-+  const void *sptr1, asn_TYPE_descriptor_t *td2, const void *sptr2) {
-+  const BOOLEAN_t *st1 = (const BOOLEAN_t *)sptr1;
-+  const BOOLEAN_t *st2 = (const BOOLEAN_t *)sptr2;
-+  asn_comp_rval_t *res = NULL;
-+
-+  COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
-+
-+  if (*st1 == *st2) return NULL;
-+  res = calloc(1, sizeof(asn_comp_rval_t));
-+  res->name = td1->name;
-+  res->structure1 = sptr1;
-+  res->structure2 = sptr2;
-+  res->err_code = COMPARE_ERR_CODE_NO_MATCH;
-+  return res;
-+}
-+
---- skeletons/BOOLEAN.h	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/BOOLEAN.h	2015-11-26 12:46:58.491623000 +0100
-@@ -30,6 +30,7 @@
- per_type_encoder_f BOOLEAN_encode_uper;
- per_type_decoder_f BOOLEAN_decode_aper;
- per_type_encoder_f BOOLEAN_encode_aper;
-+type_compare_f     BOOLEAN_compare;
- 
- #ifdef __cplusplus
- }
---- skeletons/compare.h	1970-01-01 01:00:00.000000000 +0100
-+++ skeletons/compare.h	2015-12-08 08:23:03.694566000 +0100
-@@ -0,0 +1,28 @@
-+/*-
-+ * Eurecom 2015.
-+ */
-+#ifndef	_COMPARE_H_
-+#define	_COMPARE_H_
-+
-+#include <asn_application.h>
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+struct asn_TYPE_descriptor_s;	/* Forward declaration */
-+
-+typedef asn_comp_rval_t * (type_compare_f)(
-+  struct asn_TYPE_descriptor_s *type_descriptor1,
-+  const void *struct_ptr1,
-+  struct asn_TYPE_descriptor_s *type_descriptor2,
-+  const void *struct_ptr2
-+);
-+
-+
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+#endif	/* _COMPARE_H_ */
---- skeletons/constr_CHOICE.c	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/constr_CHOICE.c	2015-12-08 10:39:16.670558000 +0100
-@@ -1272,3 +1272,75 @@
- 		assert(pres_size != sizeof(int));
- 	}
- }
-+
-+asn_comp_rval_t *
-+CHOICE_compare(asn_TYPE_descriptor_t *td1, const void *sptr1, asn_TYPE_descriptor_t *td2, const void *sptr2)
-+{
-+  asn_CHOICE_specifics_t *specs1 = (asn_CHOICE_specifics_t *)td1->specifics;
-+  asn_CHOICE_specifics_t *specs2 = (asn_CHOICE_specifics_t *)td2->specifics;
-+  int present1;
-+  int present2;
-+  asn_comp_rval_t *res = NULL;
-+
-+  COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
-+
-+  /*
-+   * Figure out which CHOICE element is encoded.
-+   */
-+  present1 = _fetch_present_idx(sptr1, specs1->pres_offset,specs1->pres_size);
-+  // same specs
-+  present2 = _fetch_present_idx(sptr2, specs2->pres_offset,specs2->pres_size);
-+
-+  if (td1->elements_count != td2->elements_count) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_CHOICE_NUM;
-+    return res;
-+  }
-+  if (present1 != present2) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_CHOICE_PRESENT;
-+    return res;
-+  }
-+  if(present1 > 0 && present1 <= td1->elements_count) {
-+    asn_TYPE_member_t *elm1 = &td1->elements[present1-1];
-+    asn_TYPE_member_t *elm2 = &td2->elements[present2-1];
-+    const void *memb_ptr1;
-+    const void *memb_ptr2;
-+
-+    if((elm1->flags & ATF_POINTER) && (elm1->flags & ATF_POINTER)){
-+      memb_ptr1 = *(const void * const *)((const char *)sptr1 + elm1->memb_offset);
-+      memb_ptr2 = *(const void * const *)((const char *)sptr2 + elm2->memb_offset);
-+      if((!memb_ptr1) || (!memb_ptr2)) {
-+        res = calloc(1, sizeof(asn_comp_rval_t));
-+        res->name = td1->name;
-+        res->structure1 = sptr1;
-+        res->structure2 = sptr2;
-+        res->err_code = COMPARE_ERR_CODE_VALUE_NULL;
-+        return res;
-+      }
-+    } else if (!(elm1->flags & ATF_POINTER) && !(elm1->flags & ATF_POINTER)){
-+      memb_ptr1 = (const void *)((const char *)sptr1 + elm1->memb_offset);
-+      memb_ptr2 = (const void *)((const char *)sptr2 + elm2->memb_offset);
-+    } else {
-+      res = calloc(1, sizeof(asn_comp_rval_t));
-+      res->name = td1->name;
-+      res->structure1 = sptr1;
-+      res->structure2 = sptr2;
-+      res->err_code = COMPARE_ERR_CODE_CHOICE_MALFORMED;
-+      return res;
-+    }
-+    return elm1->type->compare(elm1->type, memb_ptr1, elm2->type, memb_ptr2);
-+  }
-+  res = calloc(1, sizeof(asn_comp_rval_t));
-+  res->name = td1->name;
-+  res->structure1 = sptr1;
-+  res->structure2 = sptr2;
-+  res->err_code = COMPARE_ERR_CODE_CHOICE_MALFORMED;
-+  return res;
-+}
---- skeletons/constr_CHOICE.h	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/constr_CHOICE.h	2015-11-26 14:43:57.647616000 +0100
-@@ -39,7 +39,7 @@
- /*
-  * A set specialized functions dealing with the CHOICE type.
-  */
--asn_struct_free_f CHOICE_free;
-+asn_struct_free_f  CHOICE_free;
- asn_struct_print_f CHOICE_print;
- asn_constr_check_f CHOICE_constraint;
- ber_type_decoder_f CHOICE_decode_ber;
-@@ -50,7 +50,8 @@
- per_type_encoder_f CHOICE_encode_uper;
- per_type_decoder_f CHOICE_decode_aper;
- per_type_encoder_f CHOICE_encode_aper;
--asn_outmost_tag_f CHOICE_outmost_tag;
-+type_compare_f     CHOICE_compare;
-+asn_outmost_tag_f  CHOICE_outmost_tag;
- 
- #ifdef __cplusplus
- }
---- skeletons/constr_SEQUENCE.c	2015-12-08 14:39:33.346543533 +0100
-+++ skeletons/constr_SEQUENCE.c	2015-12-08 10:39:52.442558000 +0100
-@@ -1761,3 +1761,65 @@
- 
- 	_ASN_ENCODED_OK(er);
- }
-+
-+asn_comp_rval_t * SEQUENCE_compare(asn_TYPE_descriptor_t *td1, const void *sptr1, asn_TYPE_descriptor_t *td2, const void *sptr2) {
-+  int edx;
-+  asn_comp_rval_t *res = NULL;
-+  asn_comp_rval_t *res2 = NULL;
-+
-+  COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
-+
-+  if (td1->elements_count != td2->elements_count) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_COLLECTION_NUM_ELEMENTS;
-+    return res;
-+  }
-+
-+  for(edx = 0; edx < td1->elements_count; edx++) {
-+    asn_TYPE_member_t *elm1 = &td1->elements[edx];
-+    asn_TYPE_member_t *elm2 = &td1->elements[edx];
-+    const void *memb_ptr1;
-+    const void *memb_ptr2;
-+
-+    if(elm1->flags & ATF_POINTER) {
-+      memb_ptr1 = *(const void * const *)((const char *)sptr1 + elm1->memb_offset);
-+      memb_ptr2 = *(const void * const *)((const char *)sptr2 + elm2->memb_offset);
-+      if((!memb_ptr1) && (!memb_ptr2)) {
-+        if(elm1->optional) continue;
-+      }
-+      if ((!memb_ptr1) || (!memb_ptr2)) {
-+        res2 = calloc(1, sizeof(asn_comp_rval_t));
-+        res2->name = elm1->name;
-+        res2->structure1 = memb_ptr1;
-+        res2->structure2 = memb_ptr2;
-+        res->err_code = COMPARE_ERR_CODE_VALUE_NULL;
-+        if (NULL == res) {
-+          res = res2;
-+        } else {
-+          res2->next = res;
-+          res = res2;
-+        }
-+        res2 = NULL;
-+      }
-+    } else {
-+      memb_ptr1 = (const void *)((const char *)sptr1 + elm1->memb_offset);
-+      memb_ptr2 = (const void *)((const char *)sptr2 + elm2->memb_offset);
-+    }
-+
-+    /* Compare the member itself */
-+    res2 = elm1->type->compare(elm1->type, memb_ptr1, elm2->type, memb_ptr2);
-+    if(res2) {
-+      if (NULL == res) {
-+        res = res2;
-+      } else {
-+        res2->next = res;
-+        res = res2;
-+      }
-+      res2 = NULL;
-+    }
-+  }
-+  return res;
-+}
---- skeletons/constr_SEQUENCE.h	2015-12-08 14:39:33.346543533 +0100
-+++ skeletons/constr_SEQUENCE.h	2015-11-26 14:48:14.123616000 +0100
-@@ -54,6 +54,7 @@
- per_type_encoder_f SEQUENCE_encode_uper;
- per_type_decoder_f SEQUENCE_decode_aper;
- per_type_encoder_f SEQUENCE_encode_aper;
-+type_compare_f     SEQUENCE_compare;
- 
- #ifdef __cplusplus
- }
---- skeletons/constr_SEQUENCE_OF.h	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/constr_SEQUENCE_OF.h	2015-11-26 15:05:25.399615000 +0100
-@@ -22,7 +22,8 @@
- #define	SEQUENCE_OF_decode_ber	SET_OF_decode_ber
- #define	SEQUENCE_OF_decode_xer	SET_OF_decode_xer
- #define	SEQUENCE_OF_decode_uper	SET_OF_decode_uper
--#define	SEQUENCE_OF_decode_aper	SET_OF_decode_aper
-+#define SEQUENCE_OF_decode_aper SET_OF_decode_aper
-+#define SEQUENCE_OF_compare     SET_OF_compare
- der_type_encoder_f SEQUENCE_OF_encode_der;
- xer_type_encoder_f SEQUENCE_OF_encode_xer;
- per_type_encoder_f SEQUENCE_OF_encode_uper;
---- skeletons/constr_SET.c	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/constr_SET.c	2015-12-08 10:40:35.066558000 +0100
-@@ -1108,7 +1108,7 @@
- 	}
- }
- 
--int
-+long
- SET_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
- 		asn_app_constraint_failed_f *ctfailcb, void *app_key) {
- 	int edx;
-@@ -1159,3 +1159,58 @@
- 
- 	return 0;
- }
-+
-+asn_comp_rval_t *
-+SET_compare(asn_TYPE_descriptor_t *td1, const void *sptr1, asn_TYPE_descriptor_t *td2, const void *sptr2)
-+{
-+  int edx;
-+  asn_comp_rval_t *res = NULL;
-+  asn_comp_rval_t *res2 = NULL;
-+
-+  COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
-+
-+  if (td1->elements_count != td2->elements_count) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_COLLECTION_NUM_ELEMENTS;
-+    return res;
-+  }
-+
-+  for(edx = 0; edx < td1->elements_count; edx++) {
-+    asn_TYPE_member_t *elm1 = &td1->elements[edx];
-+    asn_TYPE_member_t *elm2 = &td2->elements[edx];
-+    const void *memb_ptr1;
-+    const void *memb_ptr2;
-+
-+    if(elm1->flags & ATF_POINTER) {
-+      memb_ptr1 = *(const void * const *)((const char *)sptr1 + elm1->memb_offset);
-+      memb_ptr2 = *(const void * const *)((const char *)sptr2 + elm2->memb_offset);
-+      if(!memb_ptr1) {
-+        if(elm1->optional)
-+          continue;
-+        res = calloc(1, sizeof(asn_comp_rval_t));
-+        res->name = td1->name;
-+        res->structure1 = sptr1;
-+        res->structure2 = sptr2;
-+        res->err_code = COMPARE_ERR_CODE_SET_MALFORMED;
-+        return res;
-+      }
-+    } else {
-+      memb_ptr1 = (const void *)((const char *)sptr1 + elm1->memb_offset);
-+      memb_ptr2 = (const void *)((const char *)sptr2 + elm2->memb_offset);
-+    }
-+    res2 = elm1->type->compare(elm1->type, memb_ptr1, elm2->type, memb_ptr2);
-+    if(res2) {
-+      if (NULL == res) {
-+        res = res2;
-+      } else {
-+        res2->next = res;
-+        res = res2;
-+      }
-+      res2 = NULL;
-+    }
-+  }
-+  return res;
-+}
---- skeletons/constr_SET.h	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/constr_SET.h	2015-11-26 14:49:09.243616000 +0100
-@@ -56,6 +56,7 @@
- per_type_decoder_f SET_decode_aper;
- per_type_encoder_f SET_encode_uper;
- per_type_encoder_f SET_encode_aper;
-+type_compare_f     SET_compare;
- 
- /***********************
-  * Some handy helpers. *
---- skeletons/constr_SET_OF.c	2015-12-08 14:39:33.338543533 +0100
-+++ skeletons/constr_SET_OF.c	2015-12-08 10:45:54.466557000 +0100
-@@ -1039,3 +1039,54 @@
- 	rv.consumed = 0;
- 	return rv;
- }
-+
-+asn_comp_rval_t *
-+SET_OF_compare(asn_TYPE_descriptor_t *td1, const void *sptr1, asn_TYPE_descriptor_t *td2, const void *sptr2)
-+{
-+  asn_TYPE_member_t *elm1 = td1->elements;
-+  asn_TYPE_member_t *elm2 = td2->elements;
-+  const asn_anonymous_set_ *list1 = _A_CSET_FROM_VOID(sptr1);
-+  const asn_anonymous_set_ *list2 = _A_CSET_FROM_VOID(sptr2);
-+  int i;
-+  asn_comp_rval_t *res = NULL;
-+  asn_comp_rval_t *res2 = NULL;
-+
-+  COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
-+
-+  if (td1->elements_count != td2->elements_count) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_COLLECTION_NUM_ELEMENTS;
-+    return res;
-+  }
-+
-+
-+  if (list1->count != list2->count ) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_COLLECTION_NUM_ELEMENTS;
-+    return res;
-+  }
-+
-+  for(i = 0; i < list1->count; i++) {
-+    const void *memb_ptr1 = list1->array[i];
-+    const void *memb_ptr2 = list2->array[i];
-+    if ((!memb_ptr1) & (!memb_ptr2)) continue;
-+
-+    res2 = elm1->type->compare(elm1->type, memb_ptr1, elm2->type, memb_ptr2);
-+    if(res2) {
-+      if (NULL == res) {
-+        res = res2;
-+      } else {
-+        res2->next = res;
-+        res = res2;
-+      }
-+      res2 = NULL;
-+    }
-+  }
-+  return  res;
-+}
---- skeletons/constr_SET_OF.h	2015-12-08 14:39:33.338543533 +0100
-+++ skeletons/constr_SET_OF.h	2015-11-26 14:48:45.067616000 +0100
-@@ -36,6 +36,7 @@
- per_type_encoder_f SET_OF_encode_uper;
- per_type_decoder_f SET_OF_decode_aper;
- per_type_encoder_f SET_OF_encode_aper;
-+type_compare_f     SET_OF_compare;
- 
- #ifdef __cplusplus
- }
---- skeletons/constr_TYPE.h	2015-12-08 14:39:33.338543533 +0100
-+++ skeletons/constr_TYPE.h	2015-11-26 15:28:05.495613000 +0100
-@@ -41,7 +41,8 @@
- #include <xer_encoder.h>	/* Encoder into XER (XML, text) */
- #include <per_decoder.h>	/* Packet Encoding Rules decoder */
- #include <per_encoder.h>	/* Packet Encoding Rules encoder */
--#include <constraints.h>	/* Subtype constraints support */
-+#include <constraints.h>  /* Subtype constraints support */
-+#include <compare.h>      /* Comparison */
- 
- /*
-  * Free the structure according to its specification.
-@@ -101,6 +102,7 @@
- 	per_type_encoder_f *uper_encoder;	/* Unaligned PER encoder */
- 	per_type_decoder_f *aper_decoder;	/* Aligned PER decoder */
- 	per_type_encoder_f *aper_encoder;	/* Aligned PER encoder */
-+	type_compare_f     *compare;      /* Comparison between 2 instances */
- 
- 	/***********************************************************************
- 	 * Internally useful members. Not to be used by applications directly. *
---- skeletons/ENUMERATED.c	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/ENUMERATED.c	2015-12-08 10:40:55.986558000 +0100
-@@ -27,7 +27,8 @@
- 	ENUMERATED_decode_uper,	/* Unaligned PER decoder */
- 	ENUMERATED_encode_uper,	/* Unaligned PER encoder */
- 	ENUMERATED_decode_aper,	/* Aligned PER decoder */
--	ENUMERATED_encode_aper,	/* Aligned PER encoder */
-+  ENUMERATED_encode_aper, /* Aligned PER encoder */
-+  ENUMERATED_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_ENUMERATED_tags,
- 	sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]),
-@@ -103,3 +104,22 @@
- 	
- 	return NativeEnumerated_encode_aper(td, constraints, &value, po);
- }
-+
-+asn_comp_rval_t *
-+ENUMERATED_compare(asn_TYPE_descriptor_t *td1, const void *sptr1,
-+                   asn_TYPE_descriptor_t *td2, const void *sptr2) {
-+  const ENUMERATED_t *st1 = (const ENUMERATED_t *)sptr1;
-+  const ENUMERATED_t *st2 = (const ENUMERATED_t *)sptr2;
-+  asn_comp_rval_t *res = NULL;
-+
-+  COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
-+
-+  if (*st1 == *st2) return NULL;
-+  res = calloc(1, sizeof(asn_comp_rval_t));
-+  res->name = td1->name;
-+  res->structure1 = sptr1;
-+  res->structure2 = sptr2;
-+  res->err_code = COMPARE_ERR_CODE_NO_MATCH;
-+  return res;
-+}
-+
---- skeletons/ENUMERATED.h	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/ENUMERATED.h	2015-11-26 12:46:35.523623000 +0100
-@@ -19,6 +19,7 @@
- per_type_encoder_f ENUMERATED_encode_uper;
- per_type_decoder_f ENUMERATED_decode_aper;
- per_type_encoder_f ENUMERATED_encode_aper;
-+type_compare_f     ENUMERATED_compare;
- 
- #ifdef __cplusplus
- }
---- skeletons/file-dependencies	2015-12-08 14:39:12.678543554 +0100
-+++ skeletons/file-dependencies	2015-12-07 15:34:40.454629000 +0100
-@@ -39,12 +39,13 @@
- constr_SEQUENCE.h constr_SEQUENCE.c
- constr_SEQUENCE_OF.h constr_SEQUENCE_OF.c asn_SEQUENCE_OF.h constr_SET_OF.h
- constr_SET.h constr_SET.c
--constr_SET_OF.h constr_SET_OF.c asn_SET_OF.h
-+constr_SET_OF.h constr_SET_OF.c asn_SET_OF.h compare.h
- 
- COMMON-FILES:			# THIS IS A SPECIAL SECTION
--asn_application.h		# Applications should include this file
-+asn_application.h   # Applications should include this file
- asn_system.h			# Platform-dependent types
--asn_codecs.h			# Return types of encoders and decoders
-+asn_codecs.h      # Return types of encoders and decoders
-+asn_compare.h     # Return type of compare
- asn_internal.h			# Internal stuff
- OCTET_STRING.h OCTET_STRING.c	# This one is used too widely
- BIT_STRING.h BIT_STRING.c	# This one is necessary for the above one
---- skeletons/GeneralizedTime.c	2015-12-08 14:39:33.350543533 +0100
-+++ skeletons/GeneralizedTime.c	2015-11-26 15:09:03.899615000 +0100
-@@ -168,7 +168,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_GeneralizedTime_tags,
- 	sizeof(asn_DEF_GeneralizedTime_tags)
---- skeletons/GeneralString.c	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/GeneralString.c	2015-11-26 14:50:11.843616000 +0100
-@@ -25,7 +25,8 @@
- 	OCTET_STRING_decode_uper,    /* Implemented in terms of OCTET STRING */
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_GeneralString_tags,
- 	sizeof(asn_DEF_GeneralString_tags)
---- skeletons/GraphicString.c	2015-12-08 14:39:33.350543533 +0100
-+++ skeletons/GraphicString.c	2015-11-26 15:33:33.255613000 +0100
-@@ -25,7 +25,8 @@
- 	OCTET_STRING_decode_uper,    /* Implemented in terms of OCTET STRING */
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_GraphicString_tags,
- 	sizeof(asn_DEF_GraphicString_tags)
---- skeletons/IA5String.c	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/IA5String.c	2015-11-26 14:50:44.219616000 +0100
-@@ -31,6 +31,7 @@
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
- 	OCTET_STRING_encode_aper,
-+	OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_IA5String_tags,
- 	sizeof(asn_DEF_IA5String_tags)
---- skeletons/INTEGER.c	2015-12-08 14:39:33.346543533 +0100
-+++ skeletons/INTEGER.c	2015-12-08 10:41:08.526558000 +0100
-@@ -35,6 +35,7 @@
- 	INTEGER_decode_aper,
- 	INTEGER_encode_aper,
- #endif	/* ASN_DISABLE_PER_SUPPORT */
-+	INTEGER_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_INTEGER_tags,
- 	sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]),
-@@ -1501,3 +1502,30 @@
- }
- 
- 
-+asn_comp_rval_t *
-+INTEGER_compare(asn_TYPE_descriptor_t *td1, const void *sptr1,
-+                asn_TYPE_descriptor_t *td2, const void *sptr2) {
-+  const INTEGER_t *st1 = (const INTEGER_t *)sptr1;
-+  const INTEGER_t *st2 = (const INTEGER_t *)sptr2;
-+  asn_comp_rval_t *res = NULL;
-+
-+  COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
-+
-+  if (st1->size != st2->size) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_NO_MATCH;
-+    return res;
-+  }
-+  if (0 != memcmp(st1->buf, st2->buf, st1->size)) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_NO_MATCH;
-+    return res;
-+  }
-+  return NULL;
-+}
---- skeletons/INTEGER.h	2015-12-08 14:39:33.346543533 +0100
-+++ skeletons/INTEGER.h	2015-11-26 12:50:41.551623000 +0100
-@@ -43,6 +43,7 @@
- per_type_encoder_f INTEGER_encode_uper;
- per_type_decoder_f INTEGER_decode_aper;
- per_type_encoder_f INTEGER_encode_aper;
-+type_compare_f     INTEGER_compare;
- 
- /***********************************
-  * Some handy conversion routines. *
---- skeletons/ISO646String.c	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/ISO646String.c	2015-11-26 12:55:48.327623000 +0100
-@@ -30,7 +30,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_ISO646String_tags,
- 	sizeof(asn_DEF_ISO646String_tags)
---- skeletons/Makefile.am	2015-12-08 14:39:12.666543554 +0100
-+++ skeletons/Makefile.am	2015-12-07 15:54:00.150628000 +0100
-@@ -46,11 +46,11 @@
- 	asn_SET_OF.c asn_SET_OF.h			\
- 	asn_application.h asn_codecs.h			\
- 	asn_codecs_prim.c asn_codecs_prim.h		\
--	asn_internal.h asn_system.h			\
-+	asn_internal.h asn_system.h asn_compare.h			\
- 	ber_decoder.c ber_decoder.h			\
- 	ber_tlv_length.c ber_tlv_length.h		\
--	ber_tlv_tag.c ber_tlv_tag.h			\
--	constr_CHOICE.c constr_CHOICE.h			\
-+	ber_tlv_tag.c ber_tlv_tag.h compare.h			\
-+	comparison.h constr_CHOICE.c constr_CHOICE.h			\
- 	constr_SEQUENCE.c constr_SEQUENCE.h		\
- 	constr_SEQUENCE_OF.c constr_SEQUENCE_OF.h	\
- 	constr_SET.c constr_SET.h			\
---- skeletons/NativeEnumerated.c	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/NativeEnumerated.c	2015-12-08 10:41:17.662558000 +0100
-@@ -31,7 +31,8 @@
- 	NativeEnumerated_decode_uper,
- 	NativeEnumerated_encode_uper,
- 	NativeEnumerated_decode_aper,
--	NativeEnumerated_encode_aper,
-+  NativeEnumerated_encode_aper,
-+  NativeEnumerated_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_NativeEnumerated_tags,
- 	sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]),
-@@ -335,3 +336,22 @@
- 
- 	_ASN_ENCODED_OK(er);
- }
-+
-+asn_comp_rval_t *
-+NativeEnumerated_compare(asn_TYPE_descriptor_t *td1, const void *sptr1,
-+    asn_TYPE_descriptor_t *td2, const void *sptr2) {
-+  const asn_INTEGER_enum_map_t *a = sptr1;
-+  const asn_INTEGER_enum_map_t *b = sptr2;
-+  asn_comp_rval_t *res = NULL;
-+
-+  COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
-+
-+  if(a->nat_value == b->nat_value)
-+    return NULL;
-+  res = calloc(1, sizeof(asn_comp_rval_t));
-+  res->name = td1->name;
-+  res->structure1 = sptr1;
-+  res->structure2 = sptr2;
-+  res->err_code = COMPARE_ERR_CODE_NO_MATCH;
-+  return res;
-+}
---- skeletons/NativeEnumerated.h	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/NativeEnumerated.h	2015-11-26 14:51:43.315616000 +0100
-@@ -26,6 +26,7 @@
- per_type_encoder_f NativeEnumerated_encode_uper;
- per_type_decoder_f NativeEnumerated_decode_aper;
- per_type_encoder_f NativeEnumerated_encode_aper;
-+type_compare_f     NativeEnumerated_compare;
- 
- #ifdef __cplusplus
- }
---- skeletons/NativeInteger.c	2015-12-08 14:39:33.346543533 +0100
-+++ skeletons/NativeInteger.c	2015-12-08 10:41:24.550558000 +0100
-@@ -32,7 +32,8 @@
- 	NativeInteger_decode_uper,	/* Unaligned PER decoder */
- 	NativeInteger_encode_uper,	/* Unaligned PER encoder */
- 	NativeInteger_decode_aper,	/* Aligned PER decoder */
--	NativeInteger_encode_aper,	/* Aligned PER encoder */
-+  NativeInteger_encode_aper,  /* Aligned PER encoder */
-+  NativeInteger_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_NativeInteger_tags,
- 	sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]),
-@@ -410,3 +411,21 @@
- 	}
- }
- 
-+
-+asn_comp_rval_t *
-+NativeInteger_compare(asn_TYPE_descriptor_t *td1, const void *sptr1,
-+                      asn_TYPE_descriptor_t *td2, const void *sptr2) {
-+  const long *native1 = (const long *)sptr1;
-+  const long *native2 = (const long *)sptr2;
-+  asn_comp_rval_t *res = NULL;
-+
-+  COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
-+
-+  if (*native1 == *native2) return NULL;
-+  res = calloc(1, sizeof(asn_comp_rval_t));
-+  res->name = td1->name;
-+  res->structure1 = sptr1;
-+  res->structure2 = sptr2;
-+  res->err_code = COMPARE_ERR_CODE_NO_MATCH;
-+  return res;
-+}
---- skeletons/NativeInteger.h	2015-12-08 14:39:33.346543533 +0100
-+++ skeletons/NativeInteger.h	2015-11-26 14:52:13.931616000 +0100
-@@ -31,6 +31,7 @@
- per_type_encoder_f NativeInteger_encode_uper;
- per_type_decoder_f NativeInteger_decode_aper;
- per_type_encoder_f NativeInteger_encode_aper;
-+type_compare_f     NativeInteger_compare;
- 
- #ifdef __cplusplus
- }
---- skeletons/NativeReal.c	2015-12-08 14:39:33.350543533 +0100
-+++ skeletons/NativeReal.c	2015-12-08 10:41:32.666558000 +0100
-@@ -33,7 +33,8 @@
- 	NativeReal_decode_uper,
- 	NativeReal_encode_uper,
- 	NativeReal_decode_aper,
--	NativeReal_encode_aper,
-+  NativeReal_encode_aper,
-+  NativeReal_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_NativeReal_tags,
- 	sizeof(asn_DEF_NativeReal_tags) / sizeof(asn_DEF_NativeReal_tags[0]),
-@@ -405,3 +406,30 @@
- 	}
- }
- 
-+asn_comp_rval_t *
-+NativeReal_compare(asn_TYPE_descriptor_t *td1, const void *sptr1,
-+                   asn_TYPE_descriptor_t *td2, const void *sptr2) {
-+  const REAL_t *st1 = (const REAL_t *)sptr1;
-+  const REAL_t *st2 = (const REAL_t *)sptr2;
-+  asn_comp_rval_t *res = NULL;
-+
-+  COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
-+
-+  if (st1->size != st2->size) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_NO_MATCH;
-+    return res;
-+  }
-+  if (0 != memcmp(st1->buf, st2->buf, st1->size)) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_NO_MATCH;
-+    return res;
-+  }
-+  return NULL;
-+}
---- skeletons/NativeReal.h	2015-12-08 14:39:33.350543533 +0100
-+++ skeletons/NativeReal.h	2015-11-26 14:31:12.631617000 +0100
-@@ -29,6 +29,7 @@
- per_type_encoder_f NativeReal_encode_uper;
- per_type_decoder_f NativeReal_decode_aper;
- per_type_encoder_f NativeReal_encode_aper;
-+type_compare_f     NativeReal_compare;
- 
- #ifdef __cplusplus
- }
---- skeletons/NULL.c	2015-12-08 14:39:33.338543533 +0100
-+++ skeletons/NULL.c	2015-12-07 10:49:05.178647000 +0100
-@@ -26,7 +26,8 @@
- 	NULL_decode_uper,	/* Unaligned PER decoder */
- 	NULL_encode_uper,	/* Unaligned PER encoder */
- 	NULL_decode_aper,	/* Aligned PER decoder */
--	NULL_encode_aper,	/* Aligned PER encoder */
-+  NULL_encode_aper, /* Aligned PER encoder */
-+  NULL_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_NULL_tags,
- 	sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]),
-@@ -192,3 +193,10 @@
- 	er.encoded = 0;
- 	_ASN_ENCODED_OK(er);
- }
-+
-+asn_comp_rval_t *
-+NULL_compare(asn_TYPE_descriptor_t *td1, const void *sptr1,
-+             asn_TYPE_descriptor_t *td2, const void *sptr2) {
-+
-+  return NULL;
-+}
---- skeletons/NULL.h	2015-12-08 14:39:33.338543533 +0100
-+++ skeletons/NULL.h	2015-11-26 14:53:03.875616000 +0100
-@@ -27,6 +27,7 @@
- per_type_encoder_f NULL_encode_uper;
- per_type_decoder_f NULL_decode_aper;
- per_type_encoder_f NULL_encode_aper;
-+type_compare_f     NULL_compare;
- 
- #ifdef __cplusplus
- }
---- skeletons/NumericString.c	2015-12-08 14:39:33.338543533 +0100
-+++ skeletons/NumericString.c	2015-11-26 14:40:39.407616000 +0100
-@@ -50,7 +50,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_NumericString_tags,
- 	sizeof(asn_DEF_NumericString_tags)
---- skeletons/ObjectDescriptor.c	2015-12-08 14:39:33.338543533 +0100
-+++ skeletons/ObjectDescriptor.c	2015-11-26 14:55:46.227615000 +0100
-@@ -25,7 +25,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_ObjectDescriptor_tags,
- 	sizeof(asn_DEF_ObjectDescriptor_tags)
---- skeletons/OBJECT_IDENTIFIER.c	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/OBJECT_IDENTIFIER.c	2015-11-26 14:55:13.311615000 +0100
-@@ -28,7 +28,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_OBJECT_IDENTIFIER_tags,
- 	sizeof(asn_DEF_OBJECT_IDENTIFIER_tags)
---- skeletons/OCTET_STRING.c	2015-12-08 14:39:44.554543521 +0100
-+++ skeletons/OCTET_STRING.c	2015-12-08 10:41:42.838558000 +0100
-@@ -37,7 +37,8 @@
- 	OCTET_STRING_decode_uper,	/* Unaligned PER decoder */
- 	OCTET_STRING_encode_uper,	/* Unaligned PER encoder */
- 	OCTET_STRING_decode_aper,	/* Aligned PER decoder */
--	OCTET_STRING_encode_aper,	/* Aligned PER encoder */
-+  OCTET_STRING_encode_aper, /* Aligned PER encoder */
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_OCTET_STRING_tags,
- 	sizeof(asn_DEF_OCTET_STRING_tags)
-@@ -2160,3 +2161,30 @@
- 	return st;
- }
- 
-+asn_comp_rval_t *
-+OCTET_STRING_compare(asn_TYPE_descriptor_t *td1,
-+  const void *sptr1, asn_TYPE_descriptor_t *td2, const void *sptr2) {
-+  const OCTET_STRING_t *st1 = (const OCTET_STRING_t *)sptr1;
-+  const OCTET_STRING_t *st2 = (const OCTET_STRING_t *)sptr2;
-+  asn_comp_rval_t *res = NULL;
-+
-+  COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
-+
-+  if (st1->size != st2->size) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_NO_MATCH;
-+    return res;
-+  }
-+  if (0 != memcmp(st1->buf, st2->buf, st1->size)) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_NO_MATCH;
-+    return res;
-+  }
-+  return NULL;
-+}
---- skeletons/OCTET_STRING.h	2015-12-08 14:39:33.350543533 +0100
-+++ skeletons/OCTET_STRING.h	2015-11-26 12:56:15.259623000 +0100
-@@ -34,6 +34,7 @@
- per_type_encoder_f OCTET_STRING_encode_uper;
- per_type_decoder_f OCTET_STRING_decode_aper;
- per_type_encoder_f OCTET_STRING_encode_aper;
-+type_compare_f     OCTET_STRING_compare;
- 
- /******************************
-  * Handy conversion routines. *
---- skeletons/PrintableString.c	2015-12-08 14:39:33.338543533 +0100
-+++ skeletons/PrintableString.c	2015-11-26 14:56:09.787615000 +0100
-@@ -60,7 +60,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_PrintableString_tags,
- 	sizeof(asn_DEF_PrintableString_tags)
---- skeletons/REAL.c	2015-12-08 14:39:33.350543533 +0100
-+++ skeletons/REAL.c	2015-12-08 10:41:55.178558000 +0100
-@@ -46,7 +46,8 @@
- 	REAL_decode_uper,
- 	REAL_encode_uper,
- 	REAL_decode_aper,
--	REAL_encode_aper,
-+  REAL_encode_aper,
-+  REAL_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_REAL_tags,
- 	sizeof(asn_DEF_REAL_tags) / sizeof(asn_DEF_REAL_tags[0]),
-@@ -741,3 +742,32 @@
- 
- 	return 0;
- }
-+
-+
-+asn_comp_rval_t *
-+REAL_compare(asn_TYPE_descriptor_t *td1, const void *sptr1,
-+             asn_TYPE_descriptor_t *td2, const void *sptr2) {
-+  const REAL_t *st1 = (const REAL_t *)sptr1;
-+  const REAL_t *st2 = (const REAL_t *)sptr2;
-+  asn_comp_rval_t *res = NULL;
-+
-+  COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
-+
-+  if (st1->size != st2->size) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_NO_MATCH;
-+    return res;
-+  }
-+  if (0 != memcmp(st1->buf, st2->buf, st1->size)) {
-+    res = calloc(1, sizeof(asn_comp_rval_t));
-+    res->name = td1->name;
-+    res->structure1 = sptr1;
-+    res->structure2 = sptr2;
-+    res->err_code = COMPARE_ERR_CODE_NO_MATCH;
-+    return res;
-+  }
-+  return NULL;
-+}
---- skeletons/REAL.h	2015-12-08 14:39:33.350543533 +0100
-+++ skeletons/REAL.h	2015-11-26 13:00:46.183623000 +0100
-@@ -23,6 +23,7 @@
- per_type_encoder_f REAL_encode_uper;
- per_type_decoder_f REAL_decode_aper;
- per_type_encoder_f REAL_encode_aper;
-+type_compare_f     REAL_compare;
- 
- /***********************************
-  * Some handy conversion routines. *
---- skeletons/RELATIVE-OID.c	2015-12-08 14:39:33.338543533 +0100
-+++ skeletons/RELATIVE-OID.c	2015-11-26 14:56:31.703615000 +0100
-@@ -29,7 +29,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_RELATIVE_OID_tags,
- 	sizeof(asn_DEF_RELATIVE_OID_tags)
---- skeletons/T61String.c	2015-12-08 14:39:33.338543533 +0100
-+++ skeletons/T61String.c	2015-11-26 14:57:07.235615000 +0100
-@@ -25,7 +25,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_T61String_tags,
- 	sizeof(asn_DEF_T61String_tags)
---- skeletons/TeletexString.c	2015-12-08 14:39:33.338543533 +0100
-+++ skeletons/TeletexString.c	2015-11-26 14:57:17.643615000 +0100
-@@ -25,7 +25,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_TeletexString_tags,
- 	sizeof(asn_DEF_TeletexString_tags)
---- skeletons/UniversalString.c	2015-12-08 14:39:33.350543533 +0100
-+++ skeletons/UniversalString.c	2015-11-26 14:57:29.015615000 +0100
-@@ -36,7 +36,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_UniversalString_tags,
- 	sizeof(asn_DEF_UniversalString_tags)
---- skeletons/UTCTime.c	2015-12-08 14:39:33.350543533 +0100
-+++ skeletons/UTCTime.c	2015-11-26 14:57:44.127615000 +0100
-@@ -41,7 +41,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_UTCTime_tags,
- 	sizeof(asn_DEF_UTCTime_tags)
---- skeletons/UTF8String.c	2015-12-08 14:39:33.314543533 +0100
-+++ skeletons/UTF8String.c	2015-11-26 14:06:54.563618000 +0100
-@@ -27,6 +27,7 @@
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
- 	OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_UTF8String_tags,
- 	sizeof(asn_DEF_UTF8String_tags)
---- skeletons/VideotexString.c	2015-12-08 14:39:33.342543533 +0100
-+++ skeletons/VideotexString.c	2015-11-26 14:07:06.139618000 +0100
-@@ -25,7 +25,8 @@
- 	OCTET_STRING_decode_uper,    /* Implemented in terms of OCTET STRING */
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_VideotexString_tags,
- 	sizeof(asn_DEF_VideotexString_tags)
---- skeletons/VisibleString.c	2015-12-08 14:39:33.350543533 +0100
-+++ skeletons/VisibleString.c	2015-11-26 14:07:15.283618000 +0100
-@@ -30,7 +30,8 @@
- 	OCTET_STRING_decode_uper,
- 	OCTET_STRING_encode_uper,
- 	OCTET_STRING_decode_aper,
--	OCTET_STRING_encode_aper,
-+  OCTET_STRING_encode_aper,
-+  OCTET_STRING_compare,
- 	0, /* Use generic outmost tag fetcher */
- 	asn_DEF_VisibleString_tags,
- 	sizeof(asn_DEF_VisibleString_tags)
diff --git a/openair3/S1AP/s1ap_common.c b/openair3/S1AP/s1ap_common.c
index 055641d12e529b532eb7e71718b0dcd0203f6023..dabde30b165b1a5320d4bfa901d6187b787b60c9 100644
--- a/openair3/S1AP/s1ap_common.c
+++ b/openair3/S1AP/s1ap_common.c
@@ -29,8 +29,9 @@
 
 /*! \file s1ap_common.c
  * \brief s1ap procedures for both eNB and MME
- * \author Sebastien ROUX <sebastien.roux@eurecom.fr>
- * \date 2012
+ * \author Sebastien ROUX and Navid Nikaein
+ * \email navid.nikaein@eurecom.fr 
+ * \date 2012-2015
  * \version 0.1
  */
 
diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c
index 1b683d4aa3441c24dfcd3f175b12d251fcf693f3..4a4ee47e1ed26cc6c3ba9f36b4a7fb46a49bfb86 100644
--- a/openair3/S1AP/s1ap_eNB.c
+++ b/openair3/S1AP/s1ap_eNB.c
@@ -26,6 +26,14 @@
   Address      : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
 
  *******************************************************************************/
+/*! \file s1ap_eNB.c
+ * \brief S1AP eNB task 
+ * \author  S. Roux and Navid Nikaein 
+ * \date 2010 - 2015
+ * \email: navid.nikaein@eurecom.fr
+ * \version 1.0
+ * @ingroup _s1ap
+ */
 
 #include <pthread.h>
 #include <stdio.h>
@@ -105,7 +113,8 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
   MessageDef                 *message_p                   = NULL;
   sctp_new_association_req_t *sctp_new_association_req_p  = NULL;
   s1ap_eNB_mme_data_t        *s1ap_mme_data_p             = NULL;
-
+  struct s1ap_eNB_mme_data_s *mme                         = NULL;
+ 
   DevAssert(instance_p != NULL);
   DevAssert(mme_ip_address != NULL);
 
@@ -126,27 +135,56 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
   memcpy(&sctp_new_association_req_p->local_address,
          local_ip_addr,
          sizeof(*local_ip_addr));
-
-  /* Create new MME descriptor */
-  s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p));
-  DevAssert(s1ap_mme_data_p != NULL);
-
-  s1ap_mme_data_p->cnx_id                = s1ap_eNB_fetch_add_global_cnx_id();
-  sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id;
-
-  s1ap_mme_data_p->assoc_id          = -1;
-  s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
-
-  STAILQ_INIT(&s1ap_mme_data_p->served_gummei);
-
-  /* Insert the new descriptor in list of known MME
-   * but not yet associated.
-   */
-  RB_INSERT(s1ap_mme_map, &instance_p->s1ap_mme_head, s1ap_mme_data_p);
-  s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
-  instance_p->s1ap_mme_nb ++;
-  instance_p->s1ap_mme_pending_nb ++;
-
+ 
+  S1AP_INFO("[eNB %d] check the mme registration state\n",instance_p->instance);
+	      
+  mme = s1ap_eNB_get_MME_from_instance(instance_p);
+
+  if ( mme == NULL ) {
+    
+    /* Create new MME descriptor */
+    s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p));
+    DevAssert(s1ap_mme_data_p != NULL);
+    
+    s1ap_mme_data_p->cnx_id                = s1ap_eNB_fetch_add_global_cnx_id();
+    sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id;
+    
+    s1ap_mme_data_p->assoc_id          = -1;
+    s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
+    
+    STAILQ_INIT(&s1ap_mme_data_p->served_gummei);
+  
+    /* Insert the new descriptor in list of known MME
+     * but not yet associated.
+     */
+    RB_INSERT(s1ap_mme_map, &instance_p->s1ap_mme_head, s1ap_mme_data_p);
+    s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
+    instance_p->s1ap_mme_nb ++;
+    instance_p->s1ap_mme_pending_nb ++;
+  } else if (mme->state == S1AP_ENB_STATE_WAITING) {
+    instance_p->s1ap_mme_pending_nb ++;
+    sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id;
+
+    S1AP_INFO("[eNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n",
+	      instance_p->instance, 
+	      mme->state, mme->cnx_id,
+	      instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
+
+    /*s1ap_mme_data_p->cnx_id                = mme->cnx_id;
+    sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id;
+    
+    s1ap_mme_data_p->assoc_id          = -1;
+    s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
+    */ 
+  } else {
+    
+    S1AP_WARN("[eNB %d] MME already registered but not in the waiting state, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n",
+	      instance_p->instance, 
+	      mme->state, mme->cnx_id, 
+	      instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
+    
+  }
+    
   itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
 }
 
@@ -155,13 +193,14 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
 {
   s1ap_eNB_instance_t *new_instance;
   uint8_t index;
-
+  
   DevAssert(s1ap_register_eNB != NULL);
 
   /* Look if the provided instance already exists */
   new_instance = s1ap_eNB_get_instance(instance);
-
-  if (new_instance != NULL) {
+  
+ 
+  if (new_instance != NULL) { 
     /* Checks if it is a retry on the same eNB */
     DevCheck(new_instance->eNB_id == s1ap_register_eNB->eNB_id, new_instance->eNB_id, s1ap_register_eNB->eNB_id, 0);
     DevCheck(new_instance->cell_type == s1ap_register_eNB->cell_type, new_instance->cell_type, s1ap_register_eNB->cell_type, 0);
@@ -191,7 +230,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
     /* Add the new instance to the list of eNB (meaningfull in virtual mode) */
     s1ap_eNB_insert_new_instance(new_instance);
 
-    S1AP_DEBUG("Registered new eNB[%d] and %s eNB id %u\n",
+    S1AP_INFO("Registered new eNB[%d] and %s eNB id %u\n",
                instance,
                s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
                s1ap_register_eNB->eNB_id);
@@ -203,7 +242,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
   /* Trying to connect to provided list of MME ip address */
   for (index = 0; index < s1ap_register_eNB->nb_mme; index++) {
     s1ap_eNB_register_mme(new_instance,
-    		              &s1ap_register_eNB->mme_ip_address[index],
+    		          &s1ap_register_eNB->mme_ip_address[index],
                           &s1ap_register_eNB->enb_ip_address,
                           s1ap_register_eNB->sctp_in_streams,
                           s1ap_register_eNB->sctp_out_streams);
@@ -327,6 +366,12 @@ void *s1ap_eNB_task(void *arg)
     }
     break;
 
+    case S1AP_E_RAB_SETUP_RESP: {
+      s1ap_eNB_e_rab_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
+				&S1AP_E_RAB_SETUP_RESP(received_msg));
+    }
+    break;
+      
     case S1AP_NAS_NON_DELIVERY_IND: {
       s1ap_eNB_nas_non_delivery_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
                                     &S1AP_NAS_NON_DELIVERY_IND(received_msg));
diff --git a/openair3/S1AP/s1ap_eNB_context_management_procedures.c b/openair3/S1AP/s1ap_eNB_context_management_procedures.c
index 801dfd8780aa9769f88a94446c88c8a65c479d39..8bf5d0a313a5d283601614a555f0200ddd9bd065 100755
--- a/openair3/S1AP/s1ap_eNB_context_management_procedures.c
+++ b/openair3/S1AP/s1ap_eNB_context_management_procedures.c
@@ -26,7 +26,14 @@
   Address      : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
 
  *******************************************************************************/
-
+/*! \file s1ap_eNB_context_management_procedures.c
+ * \brief S1AP context management procedures 
+ * \author  S. Roux and Navid Nikaein 
+ * \date 2010 - 2015
+ * \email: navid.nikaein@eurecom.fr
+ * \version 1.0
+ * @ingroup _s1ap
+ */
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
diff --git a/openair3/S1AP/s1ap_eNB_decoder.c b/openair3/S1AP/s1ap_eNB_decoder.c
index f8230520ce25acda109361a94d467f1d4cfc3002..d60e19f352363766905508d6ae56139902bee10d 100644
--- a/openair3/S1AP/s1ap_eNB_decoder.c
+++ b/openair3/S1AP/s1ap_eNB_decoder.c
@@ -29,8 +29,9 @@
 
 /*! \file s1ap_eNB_decoder.c
  * \brief s1ap pdu decode procedures for eNB
- * \author Sebastien ROUX <sebastien.roux@eurecom.fr>
- * \date 2013
+ * \author Sebastien ROUX and Navid Nikaein
+ * \email navid.nikaein@eurecom.fr
+ * \date 2013 - 2015
  * \version 0.1
  */
 
@@ -120,6 +121,29 @@ static int s1ap_eNB_decode_initiating_message(s1ap_message *message,
     break;
 
 
+  case S1ap_ProcedureCode_id_E_RABSetup:
+    ret = s1ap_decode_s1ap_e_rabsetuprequesties(
+						&message->msg.s1ap_E_RABSetupRequestIEs, &initiating_p->value);
+    //s1ap_xer_print_s1ap_e_rabsetuprequest(s1ap_xer__print2sp, message_string, message);
+    message_id = S1AP_E_RAB_SETUP_REQUEST_LOG;
+    message_string_size = strlen(message_string);
+    message_p           = itti_alloc_new_message_sized(TASK_S1AP,
+                          message_id,
+                          message_string_size + sizeof (IttiMsgText));
+    message_p->ittiMsg.s1ap_e_rab_setup_request_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_request_log.text, message_string, message_string_size);
+    itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+    free(message_string);
+    S1AP_INFO("E_RABSetup initiating message\n");
+    break;
+  case S1ap_ProcedureCode_id_E_RABRelease:
+    ret = s1ap_decode_s1ap_e_rabreleasecommandies(&message->msg.s1ap_E_RABReleaseCommandIEs, 
+						 &initiating_p->value);
+    //s1ap_xer_print_s1ap_e_rabsetuprequest(s1ap_xer__print2sp, message_string, message);
+    S1AP_INFO("TODO  E_RABRelease nitiating message\n");
+    free(message_string);
+    break;
+
   default:
     S1AP_ERROR("Unknown procedure ID (%d) for initiating message\n",
                (int)initiating_p->procedureCode);
diff --git a/openair3/S1AP/s1ap_eNB_encoder.c b/openair3/S1AP/s1ap_eNB_encoder.c
index a93bdc68f2023f981e5ad9e86221c028bcf5fd23..58f7cc175342ff46e703c01d73d07934e3fe4e5c 100644
--- a/openair3/S1AP/s1ap_eNB_encoder.c
+++ b/openair3/S1AP/s1ap_eNB_encoder.c
@@ -29,8 +29,9 @@
 
 /*! \file s1ap_eNB_encoder.c
  * \brief s1ap pdu encode procedures for eNB
- * \author Sebastien ROUX <sebastien.roux@eurecom.fr>
- * \date 2013
+ * \author Sebastien ROUX and Navid Nikaein
+ * \email navid.nikaein@eurecom.fr
+ * \date 2013 - 2015
  * \version 0.1
  */
 
@@ -38,6 +39,8 @@
 #include <string.h>
 #include <stdint.h>
 
+#include "assertions.h"
+
 #include "conversions.h"
 
 #include "intertask_interface.h"
@@ -100,6 +103,11 @@ int s1ap_eNB_encode_ue_context_release_request(
   uint8_t                              **buffer,
   uint32_t                              *length);
 
+static inline
+int s1ap_eNB_encode_e_rab_setup_response(S1ap_E_RABSetupResponseIEs_t  *E_RABSetupResponseIEs,
+					 uint8_t                              **buffer,
+					 uint32_t                              *length);
+
 int s1ap_eNB_encode_pdu(s1ap_message *message, uint8_t **buffer, uint32_t *len)
 {
   DevAssert(message != NULL);
@@ -251,8 +259,21 @@ int s1ap_eNB_encode_successfull_outcome(s1ap_message *s1ap_message_p,
     free(message_string);
     break;
 
+  case S1ap_ProcedureCode_id_E_RABSetup:
+
+    ret = s1ap_eNB_encode_e_rab_setup_response (
+           &s1ap_message_p->msg.s1ap_E_RABSetupResponseIEs, buffer, len);
+    //s1ap_xer_print_s1ap_e_rabsetupresponse (s1ap_xer__print2sp, message_string, s1ap_message_p);
+    message_id =  S1AP_E_RAB_SETUP_RESPONSE_LOG ;
+    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
+    message_p->ittiMsg.s1ap_e_rab_setup_response_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_response_log.text, message_string, message_string_size);
+    itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+    free(message_string);
+    S1AP_INFO("E_RABSetup successful message\n");
+    break;
   default:
-    S1AP_DEBUG("Unknown procedure ID (%d) for successfull outcome message\n",
+    S1AP_WARN("Unknown procedure ID (%d) for successfull outcome message\n",
                (int)s1ap_message_p->procedureCode);
     return ret;
     break;
@@ -528,3 +549,25 @@ int s1ap_eNB_encode_ue_context_release_request(
                                           ue_context_release_request_p);
 }
 
+static inline
+int s1ap_eNB_encode_e_rab_setup_response(S1ap_E_RABSetupResponseIEs_t  *s1ap_E_RABSetupResponseIEs,
+					 uint8_t                              **buffer,
+					 uint32_t                              *length)
+{
+  S1ap_E_RABSetupResponse_t  e_rab_setup_response;
+  S1ap_E_RABSetupResponse_t  *e_rab_setup_response_p = &e_rab_setup_response;
+  
+  memset((void *)e_rab_setup_response_p, 0,
+         sizeof(e_rab_setup_response));
+
+  if (s1ap_encode_s1ap_e_rabsetupresponseies (e_rab_setup_response_p, s1ap_E_RABSetupResponseIEs) < 0) {
+    return -1;
+  }
+  
+  return s1ap_generate_successfull_outcome(buffer,
+         length,
+         S1ap_ProcedureCode_id_E_RABSetup,
+         S1ap_Criticality_reject,
+         &asn_DEF_S1ap_E_RABSetupResponse,
+         e_rab_setup_response_p);
+}
diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c
index fb9722dbc813d0b9f8c8db911445c474904315b5..f99c5128bd6bce466a1bd05876c9d9f6b4c4d68f 100644
--- a/openair3/S1AP/s1ap_eNB_handlers.c
+++ b/openair3/S1AP/s1ap_eNB_handlers.c
@@ -29,8 +29,9 @@
 
 /*! \file s1ap_eNB_handlers.c
  * \brief s1ap messages handlers for eNB part
- * \author Sebastien ROUX <sebastien.roux@eurecom.fr>
- * \date 2013
+ * \author Sebastien ROUX and Navid Nikaein
+ * \email navid.nikaein@eurecom.fr
+ * \date 2013 - 2015
  * \version 0.1
  */
 
@@ -82,6 +83,13 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t               assoc_id,
     uint32_t               stream,
     struct s1ap_message_s *s1ap_message_p);
 
+
+static
+int s1ap_eNB_handle_e_rab_setup_request(uint32_t               assoc_id,
+					uint32_t               stream,
+					struct s1ap_message_s *s1ap_message_p);
+
+
 /* Handlers matrix. Only eNB related procedure present here */
 s1ap_message_decoded_callback messages_callback[][3] = {
   { 0, 0, 0 }, /* HandoverPreparation */
@@ -89,7 +97,7 @@ s1ap_message_decoded_callback messages_callback[][3] = {
   { 0, 0, 0 }, /* HandoverNotification */
   { 0, 0, 0 }, /* PathSwitchRequest */
   { 0, 0, 0 }, /* HandoverCancel */
-  { 0, 0, 0 }, /* E_RABSetup */
+  { s1ap_eNB_handle_e_rab_setup_request, 0, 0 }, /* E_RABSetup */
   { 0, 0, 0 }, /* E_RABModify */
   { 0, 0, 0 }, /* E_RABRelease */
   { 0, 0, 0 }, /* E_RABReleaseIndication */
@@ -762,7 +770,8 @@ int s1ap_eNB_handle_initial_context_request(uint32_t               assoc_id,
         malloc(sizeof(uint8_t) * item_p->nAS_PDU->size);
 
       memcpy(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer,
-             item_p->nAS_PDU->buf, item_p->nAS_PDU->size);
+             item_p->nAS_PDU->buf, item_p->nAS_PDU->size); 
+      S1AP_DEBUG("Received NAS message with the E_RAB setup procedure\n");
     } else {
       S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.length = 0;
       S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer = NULL;
@@ -873,3 +882,113 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t               assoc_id,
   }
 }
 
+static
+int s1ap_eNB_handle_e_rab_setup_request(uint32_t               assoc_id,
+					uint32_t               stream,
+					struct s1ap_message_s *s1ap_message_p) {
+
+  int i;
+
+  s1ap_eNB_mme_data_t   *mme_desc_p       = NULL;
+  s1ap_eNB_ue_context_t *ue_desc_p        = NULL;
+  MessageDef            *message_p        = NULL;
+
+  S1ap_E_RABSetupRequestIEs_t         *s1ap_E_RABSetupRequest;
+  DevAssert(s1ap_message_p != NULL);
+
+  s1ap_E_RABSetupRequest = &s1ap_message_p->msg.s1ap_E_RABSetupRequestIEs;
+
+  if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
+    S1AP_ERROR("[SCTP %d] Received initial context setup request for non "
+               "existing MME context\n", assoc_id);
+    return -1;
+  }
+
+    
+  if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance,
+                   s1ap_E_RABSetupRequest->eNB_UE_S1AP_ID)) == NULL) {
+    S1AP_ERROR("[SCTP %d] Received initial context setup request for non "
+               "existing UE context 0x%06x\n", assoc_id,
+               s1ap_E_RABSetupRequest->eNB_UE_S1AP_ID);
+    return -1;
+  }
+
+  /* Initial context request = UE-related procedure -> stream != 0 */
+  if (stream == 0) {
+    S1AP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n",
+               assoc_id, stream);
+    return -1;
+  }
+
+  ue_desc_p->rx_stream = stream;
+
+  if ( ue_desc_p->mme_ue_s1ap_id != s1ap_E_RABSetupRequest->mme_ue_s1ap_id){
+    S1AP_WARN("UE context mme_ue_s1ap_id is different form that of the message (%d != %d)", 
+	      ue_desc_p->mme_ue_s1ap_id, s1ap_E_RABSetupRequest->mme_ue_s1ap_id);
+
+  }
+  message_p        = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_SETUP_REQ);
+ 
+  S1AP_E_RAB_SETUP_REQ(message_p).ue_initial_id  = ue_desc_p->ue_initial_id;
+  
+  S1AP_E_RAB_SETUP_REQ(message_p).mme_ue_s1ap_id  = s1ap_E_RABSetupRequest->mme_ue_s1ap_id;
+  S1AP_E_RAB_SETUP_REQ(message_p).eNB_ue_s1ap_id  = s1ap_E_RABSetupRequest->eNB_UE_S1AP_ID;
+   
+   S1AP_E_RAB_SETUP_REQ(message_p).nb_e_rabs_tosetup =
+    s1ap_E_RABSetupRequest->e_RABToBeSetupListBearerSUReq.s1ap_E_RABToBeSetupItemBearerSUReq.count;
+ 
+  for (i = 0; i < s1ap_E_RABSetupRequest->e_RABToBeSetupListBearerSUReq.s1ap_E_RABToBeSetupItemBearerSUReq.count; i++) {
+    S1ap_E_RABToBeSetupItemBearerSUReq_t *item_p;
+   
+    item_p = (S1ap_E_RABToBeSetupItemBearerSUReq_t *)s1ap_E_RABSetupRequest->e_RABToBeSetupListBearerSUReq.s1ap_E_RABToBeSetupItemBearerSUReq.array[i];
+
+    S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].e_rab_id = item_p->e_RAB_ID;
+
+    // check for the NAS PDU
+    if (item_p->nAS_PDU.size > 0 ) {
+      S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = item_p->nAS_PDU.size;
+
+      S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size);
+
+      memcpy(S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer,
+             item_p->nAS_PDU.buf, item_p->nAS_PDU.size); 
+      // S1AP_INFO("received a NAS PDU with size %d (%02x.%02x)\n",S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length, item_p->nAS_PDU.buf[0], item_p->nAS_PDU.buf[1]);
+    } else {
+      S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = 0;
+      S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = NULL;
+      
+      S1AP_WARN("NAS PDU is not provided, generate a E_RAB_SETUP Failure (TBD) back to MME \n");
+      return -1;
+    }
+
+    /* Set the transport layer address */
+    memcpy(S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer,
+           item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size);
+    S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length =
+      item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused;
+
+    /* S1AP_INFO("sgw addr %s  len: %d (size %d, index %d)\n", 
+	      S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer,
+	      S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length,
+	      item_p->transportLayerAddress.size, i);
+    */
+    /* GTP tunnel endpoint ID */
+    OCTET_STRING_TO_INT32(&item_p->gTP_TEID, S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].gtp_teid);
+
+    /* Set the QOS informations */
+    S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI;
+
+    S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.priority_level =
+      item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel;
+    S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.pre_emp_capability =
+      item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionCapability;
+    S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.pre_emp_vulnerability =
+      item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability;
+  }
+
+  itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p);
+
+  return 0;
+}
+
+
diff --git a/openair3/S1AP/s1ap_eNB_management_procedures.c b/openair3/S1AP/s1ap_eNB_management_procedures.c
index eb30a8dadac4a37423c8f23dd61a4fd34712fa2c..d521b7b7d3dcbe945e1f9f512aebbec1d007031a 100644
--- a/openair3/S1AP/s1ap_eNB_management_procedures.c
+++ b/openair3/S1AP/s1ap_eNB_management_procedures.c
@@ -27,6 +27,15 @@
 
  *******************************************************************************/
 
+/*! \file s1ap_eNB_management_procedures.c
+ * \brief S1AP eNB task 
+ * \author  S. Roux and Navid Nikaein 
+ * \date 2010 - 2016
+ * \email: navid.nikaein@eurecom.fr
+ * \version 1.0
+ * @ingroup _s1ap
+ */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -116,6 +125,23 @@ struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME(
   return NULL;
 }
 
+struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME_from_instance(
+  s1ap_eNB_instance_t *instance_p)
+{
+ 
+  struct s1ap_eNB_mme_data_s *mme = NULL;
+  struct s1ap_eNB_mme_data_s *mme_next = NULL;
+
+  for (mme = RB_MIN(s1ap_mme_map, &instance_p->s1ap_mme_head); mme!=NULL ; mme = mme_next) {
+    mme_next = RB_NEXT(s1ap_mme_map, &instance_p->s1ap_mme_head, mme);
+    if (mme->s1ap_eNB_instance == instance_p) {
+      return mme;
+    }
+  }
+
+  return NULL;
+}
+
 s1ap_eNB_instance_t *s1ap_eNB_get_instance(instance_t instance)
 {
   s1ap_eNB_instance_t *temp = NULL;
@@ -130,3 +156,41 @@ s1ap_eNB_instance_t *s1ap_eNB_get_instance(instance_t instance)
 
   return NULL;
 }
+
+void s1ap_eNB_remove_mme_desc(s1ap_eNB_instance_t * instance) 
+{
+
+    struct s1ap_eNB_mme_data_s *mme = NULL;
+    struct s1ap_eNB_mme_data_s *mmeNext = NULL;
+    struct plmn_identity_s* plmnInfo;
+    struct served_group_id_s* groupInfo;
+    struct served_gummei_s* gummeiInfo;
+    struct mme_code_s* mmeCode;
+
+    for (mme = RB_MIN(s1ap_mme_map, &instance->s1ap_mme_head); mme; mme = mmeNext) {
+      mmeNext = RB_NEXT(s1ap_mme_map, &instance->s1ap_mme_head, mme);
+      RB_REMOVE(s1ap_mme_map, &instance->s1ap_mme_head, mme);
+      while (!STAILQ_EMPTY(&mme->served_gummei)) {
+        gummeiInfo = STAILQ_FIRST(&mme->served_gummei);
+        STAILQ_REMOVE_HEAD(&mme->served_gummei, next);
+	
+        while (!STAILQ_EMPTY(&gummeiInfo->served_plmns)) {
+	  plmnInfo = STAILQ_FIRST(&gummeiInfo->served_plmns);
+	  STAILQ_REMOVE_HEAD(&gummeiInfo->served_plmns, next);
+	  free(plmnInfo);
+        }
+        while (!STAILQ_EMPTY(&gummeiInfo->served_group_ids)) {
+	  groupInfo = STAILQ_FIRST(&gummeiInfo->served_group_ids);
+	  STAILQ_REMOVE_HEAD(&gummeiInfo->served_group_ids, next);
+	  free(groupInfo);
+        }
+        while (!STAILQ_EMPTY(&gummeiInfo->mme_codes)) {
+	  mmeCode = STAILQ_FIRST(&gummeiInfo->mme_codes);
+	  STAILQ_REMOVE_HEAD(&gummeiInfo->mme_codes, next);
+	  free(mmeCode);
+        }
+        free(gummeiInfo);
+      }
+      free(mme);
+    }
+}
diff --git a/openair3/S1AP/s1ap_eNB_management_procedures.h b/openair3/S1AP/s1ap_eNB_management_procedures.h
index 2e00add882e9ff8a866b04ec2567757abbc050b1..0fd9f8405397470e27b850b68e38145bdf3df926 100644
--- a/openair3/S1AP/s1ap_eNB_management_procedures.h
+++ b/openair3/S1AP/s1ap_eNB_management_procedures.h
@@ -34,6 +34,10 @@ struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME(
   s1ap_eNB_instance_t *instance_p,
   int32_t assoc_id, uint16_t cnx_id);
 
+struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME_from_instance(s1ap_eNB_instance_t *instance_p);
+
+void s1ap_eNB_remove_mme_desc(s1ap_eNB_instance_t * instance);
+
 void s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p);
 
 s1ap_eNB_instance_t *s1ap_eNB_get_instance(uint8_t mod_id);
diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c
index dbe0fef09116f7f61408fc8eab433c44efb15ddf..d3322a361719dbb9c44873b8d63d4e19fdeccd50 100644
--- a/openair3/S1AP/s1ap_eNB_nas_procedures.c
+++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c
@@ -26,7 +26,14 @@
   Address      : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
 
  *******************************************************************************/
-
+/*! \file s1ap_eNB_nas_procedures.c
+ * \brief S1AP eNb NAS procedure handler
+ * \author  S. Roux and Navid Nikaein 
+ * \date 2010 - 2015
+ * \email: navid.nikaein@eurecom.fr
+ * \version 1.0
+ * @ingroup _s1ap
+ */
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -579,6 +586,14 @@ int s1ap_eNB_initial_ctxt_resp(
     new_item->transportLayerAddress.size = initial_ctxt_resp_p->e_rabs[i].eNB_addr.length;
     new_item->transportLayerAddress.bits_unused = 0;
 
+    S1AP_DEBUG("initial_ctxt_resp_p: e_rab ID %d, enb_addr %d.%d.%d.%d, SIZE %d \n", 
+	      new_item->e_RAB_ID,
+	      new_item->transportLayerAddress.buf[0],
+	      new_item->transportLayerAddress.buf[1],
+	      new_item->transportLayerAddress.buf[2],
+	      new_item->transportLayerAddress.buf[3],
+	      new_item->transportLayerAddress.size);
+
     ASN_SEQUENCE_ADD(&initial_ies_p->e_RABSetupListCtxtSURes.s1ap_E_RABSetupItemCtxtSURes,
                      new_item);
   }
@@ -668,6 +683,8 @@ int s1ap_eNB_ue_capabilities(instance_t instance,
     return -1;
   }
 
+  free(ue_cap_info_ind_p->ue_radio_cap.buffer);
+
   MSC_LOG_TX_MESSAGE(
     MSC_S1AP_ENB,
     MSC_S1AP_MME,
@@ -686,3 +703,140 @@ int s1ap_eNB_ue_capabilities(instance_t instance,
   return ret;
 }
 
+//------------------------------------------------------------------------------
+int s1ap_eNB_e_rab_setup_resp(instance_t instance, 
+			      s1ap_e_rab_setup_resp_t *e_rab_setup_resp_p)
+//------------------------------------------------------------------------------
+{
+  s1ap_eNB_instance_t          *s1ap_eNB_instance_p = NULL;
+  struct s1ap_eNB_ue_context_s *ue_context_p        = NULL;
+
+  S1ap_E_RABSetupResponseIEs_t  *initial_ies_p  = NULL;
+ 
+  s1ap_message  message;
+
+  uint8_t  *buffer  = NULL;
+  uint32_t length;
+  int      ret = -1;
+  int      i;
+
+  /* Retrieve the S1AP eNB instance associated with Mod_id */
+  s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance);
+
+  DevAssert(e_rab_setup_resp_p != NULL);
+  DevAssert(s1ap_eNB_instance_p != NULL);
+
+  if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
+					      e_rab_setup_resp_p->eNB_ue_s1ap_id)) == NULL) {
+    /* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */
+    S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: 0x%06x\n",
+              e_rab_setup_resp_p->eNB_ue_s1ap_id);
+    return -1;
+  }
+
+  /* Uplink NAS transport can occur either during an s1ap connected state
+   * or during initial attach (for example: NAS authentication).
+   */
+  if (!(ue_context_p->ue_state == S1AP_UE_CONNECTED ||
+        ue_context_p->ue_state == S1AP_UE_WAITING_CSR)) {
+    S1AP_WARN("You are attempting to send NAS data over non-connected "
+              "eNB ue s1ap id: %06x, current state: %d\n",
+              e_rab_setup_resp_p->eNB_ue_s1ap_id, ue_context_p->ue_state);
+    return -1;
+  }
+ 
+  /* Prepare the S1AP message to encode */
+  memset(&message, 0, sizeof(s1ap_message));
+
+  message.direction     = S1AP_PDU_PR_successfulOutcome;
+  message.procedureCode = S1ap_ProcedureCode_id_E_RABSetup;
+  message.criticality   = S1ap_Criticality_reject;
+
+  initial_ies_p = &message.msg.s1ap_E_RABSetupResponseIEs;
+  
+  initial_ies_p->eNB_UE_S1AP_ID = e_rab_setup_resp_p->eNB_ue_s1ap_id;
+  initial_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id;
+  
+  if ( e_rab_setup_resp_p->nb_of_e_rabs >= 1 )
+    initial_ies_p->presenceMask |= S1AP_E_RABSETUPRESPONSEIES_E_RABSETUPLISTBEARERSURES_PRESENT; 
+  
+  for (i = 0; i < e_rab_setup_resp_p->nb_of_e_rabs; i++) { 
+    S1ap_E_RABSetupItemBearerSURes_t *new_item;
+
+    new_item = calloc(1, sizeof(S1ap_E_RABSetupItemBearerSURes_t));
+
+    new_item->e_RAB_ID = e_rab_setup_resp_p->e_rabs[i].e_rab_id;
+    GTP_TEID_TO_ASN1(e_rab_setup_resp_p->e_rabs[i].gtp_teid, &new_item->gTP_TEID);
+        
+    /*
+    new_item->transportLayerAddress.buf = MALLOC(e_rab_setup_resp_p->e_rabs[i].eNB_addr.length);  
+    memcpy (new_item->transportLayerAddress.buf, 
+	    e_rab_setup_resp_p->e_rabs[i].eNB_addr.buffer,
+	    e_rab_setup_resp_p->e_rabs[i].eNB_addr.length);
+    
+    */
+    /*
+      new_item->transportLayerAddress.buf[0] = e_rab_setup_resp_p->e_rabs[i].eNB_addr.buffer[0];
+    new_item->transportLayerAddress.buf[1] = e_rab_setup_resp_p->e_rabs[i].eNB_addr.buffer[1];
+    new_item->transportLayerAddress.buf[2] = e_rab_setup_resp_p->e_rabs[i].eNB_addr.buffer[2];
+    new_item->transportLayerAddress.buf[3] = e_rab_setup_resp_p->e_rabs[i].eNB_addr.buffer[3];
+    */
+    new_item->transportLayerAddress.buf = e_rab_setup_resp_p->e_rabs[i].eNB_addr.buffer; 
+    new_item->transportLayerAddress.size = e_rab_setup_resp_p->e_rabs[i].eNB_addr.length;
+    new_item->transportLayerAddress.bits_unused = 0;
+    
+    S1AP_DEBUG("e_rab_setup_resp: e_rab ID %d, teid %u, enb_addr %d.%d.%d.%d, SIZE %d\n", 
+	       new_item->e_RAB_ID,
+	       e_rab_setup_resp_p->e_rabs[i].gtp_teid,
+	       new_item->transportLayerAddress.buf[0],
+	       new_item->transportLayerAddress.buf[1],
+	       new_item->transportLayerAddress.buf[2],
+	       new_item->transportLayerAddress.buf[3],
+	       new_item->transportLayerAddress.size);
+    
+    S1ap_IE_t *ie = s1ap_new_ie(S1ap_ProtocolIE_ID_id_E_RABSetupItemBearerSURes,
+				S1ap_Criticality_ignore,
+				&asn_DEF_S1ap_E_RABSetupItemBearerSURes,
+				new_item);
+    /*
+    S1ap_IE_t *ie = s1ap_new_ie(S1ap_ProtocolIE_ID_id_E_RABSetupListBearerSURes,
+				S1ap_Criticality_ignore,
+				&asn_DEF_S1ap_E_RABSetupListBearerSURes,
+				new_item);
+    */
+    ASN_SEQUENCE_ADD(&initial_ies_p->e_RABSetupListBearerSURes.s1ap_E_RABSetupItemBearerSURes,
+                     ie);
+  }
+ 
+  /* S1ap_E_RABSetupListBearerSURes_t  e_RABSetupListBearerSURes;
+  memset(&e_RABSetupListBearerSURes, 0, sizeof(S1ap_E_RABSetupListBearerSURes_t));
+  if (s1ap_encode_s1ap_e_rabsetuplistbearersures(&e_RABSetupListBearerSURes, &initial_ies_p->e_RABSetupListBearerSURes.s1ap_E_RABSetupItemBearerSURes) < 0 )
+    return -1;
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1ap_E_RABSetupListBearerSURes, &e_RABSetupListBearerSURes);
+  */
+  fprintf(stderr, "start encode\n");
+  if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
+    S1AP_ERROR("Failed to encode uplink transport\n");
+    /* Encode procedure has failed... */
+    return -1;
+  }
+
+ 
+  
+  MSC_LOG_TX_MESSAGE(
+    MSC_S1AP_ENB,
+    MSC_S1AP_MME,
+    (const char *)buffer,
+    length,
+    MSC_AS_TIME_FMT" E_RAN Setup successfulOutcome eNB_ue_s1ap_id %u mme_ue_s1ap_id %u",
+    0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
+    initial_ies_p->eNB_UE_S1AP_ID,
+    initial_ies_p->mme_ue_s1ap_id);
+
+  /* UE associated signalling -> use the allocated stream */
+  s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
+                                   ue_context_p->mme_ref->assoc_id, buffer,
+                                   length, ue_context_p->tx_stream);
+
+  return ret;
+}
diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c
index 148843dbbcf68cad111c408939905d83946cf352..b31c96b72b56aa5d306dd22dc113f06897738ab1 100644
--- a/targets/COMMON/create_tasks.c
+++ b/targets/COMMON/create_tasks.c
@@ -51,6 +51,20 @@
 int create_tasks(uint32_t enb_nb, uint32_t ue_nb)
 {
   itti_wait_ready(1);
+  if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) {
+    LOG_E(PDCP, "Create task for L2L1 failed\n");
+    return -1;
+  }
+
+  if (enb_nb > 0) {
+    /* Last task to create, others task must be ready before its start */
+    if (itti_create_task (TASK_ENB_APP, eNB_app_task, NULL) < 0) {
+      LOG_E(ENB_APP, "Create task for eNB APP failed\n");
+      return -1;
+    }
+  }
+
+
 # ifdef OPENAIR2
   {
 #   if defined(ENABLE_USE_MME)
@@ -120,20 +134,8 @@ int create_tasks(uint32_t enb_nb, uint32_t ue_nb)
 #   endif
     }
   }
-# endif
+# endif // openair2: NN: should be openair3
 
-  if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) {
-    LOG_E(PDCP, "Create task for L2L1 failed\n");
-    return -1;
-  }
-
-  if (enb_nb > 0) {
-    /* Last task to create, others task must be ready before its start */
-    if (itti_create_task (TASK_ENB_APP, eNB_app_task, NULL) < 0) {
-      LOG_E(ENB_APP, "Create task for eNB APP failed\n");
-      return -1;
-    }
-  }
 
   itti_wait_ready(0);
 
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.usrpb210.conf
index 1bf3c6fbf29d6e4edab9162ee392857eee526f7f..83f8af699e940b71861641babb4f1b5d661421c4 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.usrpb210.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.usrpb210.conf
@@ -133,7 +133,7 @@ eNBs =
 
 
     ////////// MME parameters:
-    mme_ip_address      = ( { ipv4       = "172.27.8.52";
+    mme_ip_address      = ( { ipv4       = "192.168.12.170";
                               ipv6       = "192:168:30::17";
                               active     = "yes";
                               preference = "ipv4";
@@ -143,10 +143,10 @@ eNBs =
     NETWORK_INTERFACES :
     {
         ENB_INTERFACE_NAME_FOR_S1_MME            = "eth0";
-        ENB_IPV4_ADDRESS_FOR_S1_MME              = "172.27.8.51/23";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.241/24";
 
         ENB_INTERFACE_NAME_FOR_S1U               = "eth0";
-        ENB_IPV4_ADDRESS_FOR_S1U                 = "172.27.8.51/23";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.241/24";
         ENB_PORT_FOR_S1U                         = 2152; # Spec 2152
     };
 
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.generic.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.generic.oaisim.local_no_mme.conf
index ae989b5c8d8f5d00c0fe006a2659ac35e3feea9c..8a7a694ece58fa811b80b828139d007fda664a14 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.generic.oaisim.local_no_mme.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.generic.oaisim.local_no_mme.conf
@@ -33,8 +33,9 @@ eNBs =
         Nid_cell					      = 0;
         N_RB_DL                 			      = 25;
         Nid_cell_mbsfn          			      = 0;
-        nb_antennas_tx          			      = 1;
-        nb_antennas_rx          			      = 1;
+	nb_antenna_ports				      = 2;
+        nb_antennas_tx          			      = 2;
+        nb_antennas_rx          			      = 2;
         tx_gain                                               = 25;
         rx_gain                                               = 20;
         prach_root              			      = 0;
@@ -97,6 +98,8 @@ eNBs =
         ue_TimersAndConstants_t311			      = 10000;
         ue_TimersAndConstants_n310			      = 20;
         ue_TimersAndConstants_n311			      = 1;
+
+	ue_TransmissionMode 				      = 2;
       }
     );
 
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.generic.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.generic.oaisim.local_no_mme.conf
new file mode 100644
index 0000000000000000000000000000000000000000..bfd24f2032eadc12b51bf4c933df6616bcc7b110
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.generic.oaisim.local_no_mme.conf
@@ -0,0 +1,150 @@
+
+Active_eNBs = ( "eNB_Eurecom_LTEBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs =
+(
+ {
+    ////////// Identification parameters:
+    eNB_ID    =  0xe00;
+
+    cell_type =  "CELL_MACRO_ENB";
+
+    eNB_name  =  "eNB_Eurecom_LTEBox";
+
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code  =  "1";
+
+    mobile_country_code =  "208";
+
+    mobile_network_code =  "10";
+
+       ////////// Physical parameters:
+
+    component_carriers = (
+      {
+        frame_type					      = "TDD";
+        tdd_config 					      = 3;
+        tdd_config_s            			      = 0;
+        prefix_type             			      = "NORMAL";
+        eutra_band              			      = 38;
+        downlink_frequency      			      = 2580000000L;
+        uplink_frequency_offset 			      = 0;
+        Nid_cell					      = 0;
+        N_RB_DL                 			      = 25;
+        Nid_cell_mbsfn          			      = 0;
+	nb_antenna_ports				      = 1;
+        nb_antennas_tx          			      = 1;
+        nb_antennas_rx          			      = 1;
+        tx_gain                                               = 25;
+        rx_gain                                               = 20;
+        prach_root              			      = 0;
+        prach_config_index      			      = 0;
+        prach_high_speed        			      = "DISABLE";
+        prach_zero_correlation  			      = 1;
+        prach_freq_offset       			      = 2;
+        pucch_delta_shift       			      = 1;
+        pucch_nRB_CQI           			      = 1;
+        pucch_nCS_AN            			      = 0;
+        pucch_n1_AN             			      = 32;
+        pdsch_referenceSignalPower 			      = 0;
+        pdsch_p_b                  			      = 0;
+        pusch_n_SB                 			      = 1;
+        pusch_enable64QAM          			      = "DISABLE";
+        pusch_hoppingMode                                     = "interSubFrame";
+        pusch_hoppingOffset                                   = 0;
+        pusch_groupHoppingEnabled  			      = "ENABLE";
+        pusch_groupAssignment      			      = 0;
+        pusch_sequenceHoppingEnabled		   	  = "DISABLE";
+        pusch_nDMRS1                              = 0;
+        phich_duration                            = "NORMAL";
+        phich_resource                            = "ONESIXTH";
+        srs_enable                                = "DISABLE";
+        /*  srs_BandwidthConfig                   =;
+        srs_SubframeConfig                        =;
+        srs_ackNackST                             =;
+        srs_MaxUpPts                              =;*/
+
+        pusch_p0_Nominal                          = -108;
+        pusch_alpha                               = "AL1";
+        pucch_p0_Nominal                          = -108;
+        msg3_delta_Preamble                       = 6;
+        pucch_deltaF_Format1                      = "deltaF2";
+        pucch_deltaF_Format1b                     = "deltaF3";
+        pucch_deltaF_Format2                      = "deltaF0";
+        pucch_deltaF_Format2a                     = "deltaF0";
+        pucch_deltaF_Format2b		    	      = "deltaF0";
+
+        rach_numberOfRA_Preambles                 = 64;
+        rach_preamblesGroupAConfig                = "DISABLE";
+        /*
+        rach_sizeOfRA_PreamblesGroupA             = ;
+        rach_messageSizeGroupA                    = ;
+        rach_messagePowerOffsetGroupB             = ;
+        */
+        rach_powerRampingStep                     = 2;
+        rach_preambleInitialReceivedTargetPower   = -100;
+        rach_preambleTransMax                     = 10;
+        rach_raResponseWindowSize                 = 10;
+        rach_macContentionResolutionTimer         = 48;
+        rach_maxHARQ_Msg3Tx                       = 4;
+
+        pcch_default_PagingCycle                  = 128;
+        pcch_nB                                   = "oneT";
+        bcch_modificationPeriodCoeff			  = 2;
+        ue_TimersAndConstants_t300			      = 1000;
+        ue_TimersAndConstants_t301			      = 1000;
+        ue_TimersAndConstants_t310			      = 1000;
+        ue_TimersAndConstants_t311			      = 10000;
+        ue_TimersAndConstants_n310			      = 20;
+        ue_TimersAndConstants_n311			      = 1;
+
+	ue_TransmissionMode 				      = 1;
+      }
+    );
+
+    ////////// MME parameters:
+    mme_ip_address      = ( { ipv4       = "0.0.0.0";
+                              ipv6       = "0::0";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    NETWORK_INTERFACES :
+    {
+        ENB_INTERFACE_NAME_FOR_S1_MME            = "none";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "0.0.0.0/24";
+
+        ENB_INTERFACE_NAME_FOR_S1U               = "none";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "0.0.0.0/24";
+        ENB_PORT_FOR_S1U                         = 2153; # Spec 2152
+    };
+
+    log_config :
+    {
+      global_log_level                      ="trace";
+      global_log_verbosity                  ="medium";
+      hw_log_level                          ="info";
+      hw_log_verbosity                      ="medium";
+      phy_log_level                         ="trace";
+      phy_log_verbosity                     ="medium";
+      mac_log_level                         ="trace";
+      mac_log_verbosity                     ="medium";
+      rlc_log_level                         ="trace";
+      rlc_log_verbosity                     ="medium";
+      pdcp_log_level                        ="trace";
+      pdcp_log_verbosity                    ="medium";
+      rrc_log_level                         ="trace";
+      rrc_log_verbosity                     ="medium";
+      gtpu_log_level                        ="debug";
+      gtpu_log_verbosity                    ="medium";
+      udp_log_level                         ="debug";
+      udp_log_verbosity                     ="medium";
+      osa_log_level                         ="debug";
+      osa_log_verbosity                     ="low";
+   };
+
+  }
+);
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.exmimo2.conf
index bc9d15195cf6eb263b68e253dde77177517fabdd..54619b44d8a06653a4d9fcb155835ad8804d7045 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.exmimo2.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.exmimo2.conf
@@ -17,7 +17,7 @@ eNBs =
     
     mobile_country_code =  "208";
     
-    mobile_network_code =  "92";
+    mobile_network_code =  "94";
     
        ////////// Physical parameters:
   
@@ -33,6 +33,7 @@ eNBs =
   			   Nid_cell					      = 0;
                            N_RB_DL                 			      = 25;
                            Nid_cell_mbsfn          			      = 0;
+			   nb_antenna_ports				      = 2;
                            nb_antennas_tx          			      = 2;
                            nb_antennas_rx          			      = 2; 
 			   tx_gain                                            = 25;
@@ -97,6 +98,8 @@ eNBs =
 			   ue_TimersAndConstants_t311			      = 10000;
 			   ue_TimersAndConstants_n310			      = 20;
 			   ue_TimersAndConstants_n311			      = 1;
+			   
+			   ue_TransmissionMode	                              = 2;
 
 			 }
 			 );
@@ -132,7 +135,7 @@ eNBs =
     };
 
     ////////// MME parameters:
-    mme_ip_address      = ( { ipv4       = "192.168.13.11";
+    mme_ip_address      = ( { ipv4       = "192.168.12.70";
                               ipv6       = "192:168:30::17";
                               active     = "yes";
                               preference = "ipv4";
@@ -141,11 +144,11 @@ eNBs =
 
     NETWORK_INTERFACES : 
     {
-        ENB_INTERFACE_NAME_FOR_S1_MME            = "eth1";
-        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.13.10/24";
+        ENB_INTERFACE_NAME_FOR_S1_MME            = "eth0";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.150/24";
 
-        ENB_INTERFACE_NAME_FOR_S1U               = "eth1";
-        ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.13.10/24";
+        ENB_INTERFACE_NAME_FOR_S1U               = "eth0";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.13.150/24";
 
         ENB_PORT_FOR_S1U                         = 2152; # Spec 2152
     };
@@ -165,13 +168,13 @@ eNBs =
 */
     log_config : 
     {
-	global_log_level                      ="info"; 
+	global_log_level                      ="debug"; 
     	global_log_verbosity                  ="medium";
 	hw_log_level                          ="debug"; 
     	hw_log_verbosity                      ="medium";
-	phy_log_level                         ="info"; 
+	phy_log_level                         ="debug"; 
     	phy_log_verbosity                     ="medium";
-	mac_log_level                         ="info"; 
+	mac_log_level                         ="debug"; 
     	mac_log_verbosity                     ="high";
 	rlc_log_level                         ="info"; 
     	rlc_log_verbosity                     ="medium";
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_mme.conf
index 630d6f028e259a712b21b1c746a21d385a3ed264..6ddb2231824c2c71a00b2110379ca6f5e68e56d7 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_mme.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_mme.conf
@@ -33,8 +33,9 @@ eNBs =
   			Nid_cell					              = 0;
             N_RB_DL                 			      = 25;
             Nid_cell_mbsfn          			      = 0;
-            nb_antennas_tx          			      = 1;
-            nb_antennas_rx          			      = 1;
+	    nb_antenna_ports				      = 2;
+            nb_antennas_tx          			      = 2;
+            nb_antennas_rx          			      = 2;
 			tx_gain                                   = 25;
 			rx_gain                                   = 20;
             prach_root              			      = 0;
@@ -96,7 +97,9 @@ eNBs =
             ue_TimersAndConstants_t310			      = 1000;
             ue_TimersAndConstants_t311			      = 10000;
             ue_TimersAndConstants_n310			      = 20;
-			ue_TimersAndConstants_n311			      = 1;
+	    ue_TimersAndConstants_n311			      = 1;
+
+	    ue_TransmissionMode				      = 2;		
         }
     );
 
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf
index 50cb6747acba76737f576a55e8a36a2aa67a931a..9fa71053f4a3801e40e9cd798b8c9128a71d0179 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf
@@ -33,8 +33,9 @@ eNBs =
         Nid_cell					              = 0;
         N_RB_DL                 			      = 25;
         Nid_cell_mbsfn          			      = 0;
-        nb_antennas_tx          			      = 1;
-        nb_antennas_rx          			      = 1;
+	nb_antenna_ports				      = 2;
+        nb_antennas_tx          			      = 2;
+        nb_antennas_rx          			      = 2;
         tx_gain                                   = 25;
         rx_gain                                   = 20;
         prach_root              			      = 0;
@@ -97,6 +98,8 @@ eNBs =
         ue_TimersAndConstants_t311			      = 10000;
         ue_TimersAndConstants_n310			      = 20;
         ue_TimersAndConstants_n311			      = 1;
+
+	ue_TransmissionMode 				      = 2;
       }
     );
 
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.bladerfx40.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.bladerfx40.conf
index eb3895dc6d60a82465550128a353274cfb00595e..14a9e4981210f8f5e7161bb04a6dff82bf4a0227 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.bladerfx40.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.bladerfx40.conf
@@ -17,7 +17,7 @@ eNBs =
     
     mobile_country_code =  "208";
     
-    mobile_network_code =  "93";
+    mobile_network_code =  "95";
     
        ////////// Physical parameters:
   
@@ -132,7 +132,7 @@ eNBs =
     };
         
     ////////// MME parameters:
-    mme_ip_address      = ( { ipv4       = "192.168.12.11";
+    mme_ip_address      = ( { ipv4       = "192.168.12.170";
                               ipv6       = "192:168:30::17";
                               active     = "yes";
                               preference = "ipv4";
@@ -142,10 +142,10 @@ eNBs =
     NETWORK_INTERFACES : 
     {
         ENB_INTERFACE_NAME_FOR_S1_MME            = "eth0";
-        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.215/24";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.241/24";
 
         ENB_INTERFACE_NAME_FOR_S1U               = "eth0";
-        ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.215/24";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.241/24";
         ENB_PORT_FOR_S1U                         = 2152; # Spec 2152
     };
     
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.bladerfx40.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.bladerfx40.conf
index 5a6a9a462bdeabd1fde804c0788cc52f7366c427..265f470a22b37295a5bc3adf04cf8b929e56ed19 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.bladerfx40.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.bladerfx40.conf
@@ -33,6 +33,7 @@ eNBs =
   			   Nid_cell					      = 0;
                            N_RB_DL                 			      = 25;
                            Nid_cell_mbsfn          			      = 0;
+			   nb_antenna_ports				      = 1;
                            nb_antennas_tx          			      = 1;
                            nb_antennas_rx          			      = 1; 
 			   tx_gain                                            = 60;
@@ -98,6 +99,7 @@ eNBs =
 			   ue_TimersAndConstants_n310			      = 20;
 			   ue_TimersAndConstants_n311			      = 1;
 
+			   ue_TransmissionMode				      = 1;
 			 }
 			 );
 
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf
index f1160e78ca43cfc91050d0e278e467e96baeca1a..38e0c3dc0a9f96401da9e049cf32e030bdf22f1c 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf
@@ -33,6 +33,7 @@ eNBs =
         Nid_cell					      = 0;
         N_RB_DL                 			      = 25;
         Nid_cell_mbsfn          			      = 0;
+        nb_antenna_ports          			      = 1;
         nb_antennas_tx          			      = 1;
         nb_antennas_rx          			      = 1;
         tx_gain                                            = 25;
@@ -97,6 +98,8 @@ eNBs =
         ue_TimersAndConstants_t311			      = 10000;
         ue_TimersAndConstants_n310			      = 20;
         ue_TimersAndConstants_n311			      = 1;
+
+	ue_TransmissionMode				      = 1;
         }
     );
 
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_mme.conf
new file mode 100644
index 0000000000000000000000000000000000000000..96107a508e4a91bbb9ccf354dd220373c6629e7c
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_mme.conf
@@ -0,0 +1,180 @@
+Active_eNBs = ( "eNB_Eurecom_LTEBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs =
+(
+ {
+    ////////// Identification parameters:
+    eNB_ID    =  0xe00;
+
+    cell_type =  "CELL_MACRO_ENB";
+
+    eNB_name  =  "eNB_Eurecom_LTEBox";
+
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code  =  "1";
+
+    mobile_country_code =  "208";
+
+    mobile_network_code =  "10";
+
+       ////////// Physical parameters:
+
+    component_carriers = (
+    	{
+  		    frame_type					              = "FDD";
+            tdd_config 					              = 3;
+            tdd_config_s            			      = 0;
+ 			prefix_type             			      = "NORMAL";
+  			eutra_band              			      = 7;
+            downlink_frequency      			      = 2680000000L;
+            uplink_frequency_offset 			      = -120000000;
+  			Nid_cell					              = 0;
+            N_RB_DL                 			      = 25;
+            Nid_cell_mbsfn          			      = 0;
+	    nb_antenna_ports				      = 1;
+            nb_antennas_tx          			      = 1;
+            nb_antennas_rx          			      = 1;
+			tx_gain                                   = 25;
+			rx_gain                                   = 20;
+            prach_root              			      = 0;
+            prach_config_index      			      = 0;
+            prach_high_speed        			      = "DISABLE";
+  	        prach_zero_correlation  			      = 1;
+            prach_freq_offset       			      = 2;
+			pucch_delta_shift       			      = 1;
+            pucch_nRB_CQI           			      = 1;
+            pucch_nCS_AN            			      = 0;
+            pucch_n1_AN             			      = 32;
+            pdsch_referenceSignalPower 			      = 0;
+            pdsch_p_b                  			      = 0;
+            pusch_n_SB                 			      = 1;
+            pusch_enable64QAM          			      = "DISABLE";
+			pusch_hoppingMode                         = "interSubFrame";
+			pusch_hoppingOffset                       = 0;
+     	    pusch_groupHoppingEnabled  			      = "ENABLE";
+	        pusch_groupAssignment      			      = 0;
+	        pusch_sequenceHoppingEnabled		   	  = "DISABLE";
+	        pusch_nDMRS1                              = 0;
+	        phich_duration                            = "NORMAL";
+	        phich_resource                            = "ONESIXTH";
+	        srs_enable                                = "DISABLE";
+	        /*  srs_BandwidthConfig                   =;
+	        srs_SubframeConfig                        =;
+	        srs_ackNackST                             =;
+	        srs_MaxUpPts                              =;*/
+
+	        pusch_p0_Nominal                          = -108;
+	        pusch_alpha                               = "AL1";
+	        pucch_p0_Nominal                          = -108;
+	        msg3_delta_Preamble                       = 6;
+	        pucch_deltaF_Format1                      = "deltaF2";
+	        pucch_deltaF_Format1b                     = "deltaF3";
+	        pucch_deltaF_Format2                      = "deltaF0";
+	        pucch_deltaF_Format2a                     = "deltaF0";
+  	        pucch_deltaF_Format2b		    	      = "deltaF0";
+
+            rach_numberOfRA_Preambles                 = 64;
+            rach_preamblesGroupAConfig                = "DISABLE";
+/*
+            rach_sizeOfRA_PreamblesGroupA             = ;
+            rach_messageSizeGroupA                    = ;
+            rach_messagePowerOffsetGroupB             = ;
+*/
+            rach_powerRampingStep                     = 2;
+            rach_preambleInitialReceivedTargetPower   = -100;
+            rach_preambleTransMax                     = 10;
+            rach_raResponseWindowSize                 = 10;
+            rach_macContentionResolutionTimer         = 48;
+            rach_maxHARQ_Msg3Tx                       = 4;
+
+            pcch_default_PagingCycle                  = 128;
+            pcch_nB                                   = "oneT";
+            bcch_modificationPeriodCoeff			  = 2;
+            ue_TimersAndConstants_t300			      = 1000;
+            ue_TimersAndConstants_t301			      = 1000;
+            ue_TimersAndConstants_t310			      = 1000;
+            ue_TimersAndConstants_t311			      = 10000;
+            ue_TimersAndConstants_n310			      = 20;
+ 	    ue_TimersAndConstants_n311			      = 1;
+
+	    ue_TransmissionMode				      = 1;
+        }
+    );
+
+
+    srb1_parameters :
+    {
+        # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] 
+        timer_poll_retransmit    = 80;
+        
+        # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
+        timer_reordering         = 35;
+        
+        # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
+        timer_status_prohibit    = 0;
+        
+        # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
+        poll_pdu                 =  4;
+        
+        # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
+        poll_byte                =  99999;
+        
+        # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
+        max_retx_threshold       =  4;
+    }
+    
+    # ------- SCTP definitions
+    SCTP :
+    {
+        # Number of streams to use in input/output
+        SCTP_INSTREAMS  = 2;
+        SCTP_OUTSTREAMS = 2;
+    };
+    
+    ////////// MME parameters:
+    mme_ip_address      = ( { ipv4       = "192.188.2.2";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    NETWORK_INTERFACES :
+    {
+        ENB_INTERFACE_NAME_FOR_S1_MME            = "tun2";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.188.2.2/24";
+
+        ENB_INTERFACE_NAME_FOR_S1U               = "lo";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "127.0.0.1/8";
+        ENB_PORT_FOR_S1U                         = 2153; # Spec 2152
+    };
+
+    log_config :
+    {
+    global_log_level                      ="trace";
+    global_log_verbosity                  ="medium";
+    hw_log_level                          ="info";
+    hw_log_verbosity                      ="medium";
+    phy_log_level                         ="trace";
+    phy_log_verbosity                     ="medium";
+    mac_log_level                         ="trace";
+    mac_log_verbosity                     ="medium";
+    rlc_log_level                         ="trace";
+    rlc_log_verbosity                     ="medium";
+    pdcp_log_level                        ="trace";
+    pdcp_log_verbosity                    ="medium";
+    rrc_log_level                         ="trace";
+    rrc_log_verbosity                     ="medium";
+    gtpu_log_level                        ="debug";
+    gtpu_log_verbosity                    ="medium";
+    udp_log_level                         ="debug";
+    udp_log_verbosity                     ="medium";
+    osa_log_level                         ="debug";
+    osa_log_verbosity                     ="low";
+
+   };
+
+  }
+);
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf
new file mode 100644
index 0000000000000000000000000000000000000000..22654ebdbb63f530d494b2dbf11e33eafd0b2cbc
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf
@@ -0,0 +1,149 @@
+Active_eNBs = ( "eNB_Eurecom_LTEBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs =
+(
+ {
+    ////////// Identification parameters:
+    eNB_ID    =  0xe00;
+
+    cell_type =  "CELL_MACRO_ENB";
+
+    eNB_name  =  "eNB_Eurecom_LTEBox";
+
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code  =  "1";
+
+    mobile_country_code =  "208";
+
+    mobile_network_code =  "10";
+
+       ////////// Physical parameters:
+
+    component_carriers = (
+      {
+        frame_type					      = "FDD";
+        tdd_config 					      = 3;
+        tdd_config_s            			      = 0;
+        prefix_type             			      = "NORMAL";
+        eutra_band              			      = 7;
+        downlink_frequency      			      = 2680000000L;
+        uplink_frequency_offset 			      = -120000000;
+        Nid_cell					              = 0;
+        N_RB_DL                 			      = 25;
+        Nid_cell_mbsfn          			      = 0;
+	nb_antenna_ports				      = 1;
+        nb_antennas_tx          			      = 1;
+        nb_antennas_rx          			      = 1;
+        tx_gain                                   = 25;
+        rx_gain                                   = 20;
+        prach_root              			      = 0;
+        prach_config_index      			      = 0;
+        prach_high_speed        			      = "DISABLE";
+        prach_zero_correlation  			      = 1;
+        prach_freq_offset       			      = 2;
+        pucch_delta_shift       			      = 1;
+        pucch_nRB_CQI           			      = 1;
+        pucch_nCS_AN            			      = 0;
+        pucch_n1_AN             			      = 32;
+        pdsch_referenceSignalPower 			      = 0;
+        pdsch_p_b                  			      = 0;
+        pusch_n_SB                 			      = 1;
+        pusch_enable64QAM          			      = "DISABLE";
+        pusch_hoppingMode                         = "interSubFrame";
+        pusch_hoppingOffset                       = 0;
+        pusch_groupHoppingEnabled  			      = "ENABLE";
+        pusch_groupAssignment      			      = 0;
+        pusch_sequenceHoppingEnabled		   	  = "DISABLE";
+        pusch_nDMRS1                              = 0;
+        phich_duration                            = "NORMAL";
+        phich_resource                            = "ONESIXTH";
+        srs_enable                                = "DISABLE";
+        /*  srs_BandwidthConfig                   =;
+        srs_SubframeConfig                        =;
+        srs_ackNackST                             =;
+        srs_MaxUpPts                              =;*/
+
+        pusch_p0_Nominal                          = -108;
+        pusch_alpha                               = "AL1";
+        pucch_p0_Nominal                          = -108;
+        msg3_delta_Preamble                       = 6;
+        pucch_deltaF_Format1                      = "deltaF2";
+        pucch_deltaF_Format1b                     = "deltaF3";
+        pucch_deltaF_Format2                      = "deltaF0";
+        pucch_deltaF_Format2a                     = "deltaF0";
+        pucch_deltaF_Format2b		    	      = "deltaF0";
+
+        rach_numberOfRA_Preambles                 = 64;
+        rach_preamblesGroupAConfig                = "DISABLE";
+        /*
+        rach_sizeOfRA_PreamblesGroupA             = ;
+        rach_messageSizeGroupA                    = ;
+        rach_messagePowerOffsetGroupB             = ;
+        */
+        rach_powerRampingStep                     = 2;
+        rach_preambleInitialReceivedTargetPower   = -100;
+        rach_preambleTransMax                     = 10;
+        rach_raResponseWindowSize                 = 10;
+        rach_macContentionResolutionTimer         = 48;
+        rach_maxHARQ_Msg3Tx                       = 4;
+
+        pcch_default_PagingCycle                  = 128;
+        pcch_nB                                   = "oneT";
+        bcch_modificationPeriodCoeff			  = 2;
+        ue_TimersAndConstants_t300			      = 1000;
+        ue_TimersAndConstants_t301			      = 1000;
+        ue_TimersAndConstants_t310			      = 1000;
+        ue_TimersAndConstants_t311			      = 10000;
+        ue_TimersAndConstants_n310			      = 20;
+        ue_TimersAndConstants_n311			      = 1;
+
+	ue_TransmissionMode				      = 1;
+      }
+    );
+
+    ////////// MME parameters:
+    mme_ip_address      = ( { ipv4       = "0.0.0.0";
+                              ipv6       = "0::0";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    NETWORK_INTERFACES :
+    {
+        ENB_INTERFACE_NAME_FOR_S1_MME            = "none";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "0.0.0.0/24";
+
+        ENB_INTERFACE_NAME_FOR_S1U               = "none";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "0.0.0.0/24";
+        ENB_PORT_FOR_S1U                         = 2153; # Spec 2152
+    };
+
+    log_config :
+    {
+      global_log_level                      ="trace";
+      global_log_verbosity                  ="medium";
+      hw_log_level                          ="info";
+      hw_log_verbosity                      ="medium";
+      phy_log_level                         ="trace";
+      phy_log_verbosity                     ="medium";
+      mac_log_level                         ="trace";
+      mac_log_verbosity                     ="medium";
+      rlc_log_level                         ="trace";
+      rlc_log_verbosity                     ="medium";
+      pdcp_log_level                        ="trace";
+      pdcp_log_verbosity                    ="medium";
+      rrc_log_level                         ="trace";
+      rrc_log_verbosity                     ="medium";
+      gtpu_log_level                        ="debug";
+      gtpu_log_verbosity                    ="medium";
+      udp_log_level                         ="debug";
+      udp_log_verbosity                     ="medium";
+      osa_log_level                         ="debug";
+      osa_log_verbosity                     ="low";
+   };
+
+  }
+);
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.lmssdr.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.lmssdr.conf
index 47e2179d18a264782163ec0ecae9ceceddb6a495..32aad42e12f890f300134c77f890185ac8d0570b 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.lmssdr.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.lmssdr.conf
@@ -33,6 +33,7 @@ eNBs =
   			   Nid_cell					      = 0;
                            N_RB_DL                 			      = 25;
                            Nid_cell_mbsfn          			      = 0;
+			   nb_antennas_ports				      = 1;
                            nb_antennas_tx          			      = 1;
                            nb_antennas_rx          			      = 1; 
 			   tx_gain                                            = 60;
@@ -98,6 +99,7 @@ eNBs =
 			   ue_TimersAndConstants_n310			      = 20;
 			   ue_TimersAndConstants_n311			      = 1;
 
+			   ue_TransmissionMode				      = 1;
 			 }
 			 );
 
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.rrh.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.rrh.usrpb210.conf
index 894781fdfd3a2a53f3253a595cd287acef2e4536..42461f3d37550834de1b8068d6cb38b80807196e 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.rrh.usrpb210.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.rrh.usrpb210.conf
@@ -33,6 +33,7 @@ eNBs =
       Nid_cell					      = 0;
       N_RB_DL                 			      = 25;
       Nid_cell_mbsfn          			      = 0;
+      nb_antennna_ports				      = 1;
       nb_antennas_tx          			      = 1;
       nb_antennas_rx          			      = 1;
       tx_gain                                            = 90;
@@ -98,6 +99,7 @@ eNBs =
       ue_TimersAndConstants_n310			      = 20;
       ue_TimersAndConstants_n311			      = 1;
 
+      ue_TransmissionMode				      = 1;
       }
     );
 
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf
index 967b0c0ca87df9807e778d8395a949cf04987407..6aa7d320cd269315a6a5919ce938925d4d03b950 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf
@@ -17,7 +17,7 @@ eNBs =
 
     mobile_country_code =  "208";
 
-    mobile_network_code =  "93";
+    mobile_network_code =  "94";
 
        ////////// Physical parameters:
 
@@ -33,6 +33,7 @@ eNBs =
         Nid_cell					      = 0;
         N_RB_DL                 			      = 25;
         Nid_cell_mbsfn          			      = 0;
+        nb_antenna_ports          			      = 1;
         nb_antennas_tx          			      = 1;
         nb_antennas_rx          			      = 1;
         tx_gain                                            = 90;
@@ -97,6 +98,8 @@ eNBs =
         ue_TimersAndConstants_t311			      = 10000;
         ue_TimersAndConstants_n310			      = 20;
         ue_TimersAndConstants_n311			      = 1;
+
+	ue_TransmissionMode				      = 1;
       }
     );
 
@@ -130,7 +133,7 @@ eNBs =
     };
 
     ////////// MME parameters:
-    mme_ip_address      = ( { ipv4       = "192.168.12.11";
+    mme_ip_address      = ( { ipv4       = "192.168.12.70";
                               ipv6       = "192:168:30::17";
                               active     = "yes";
                               preference = "ipv4";
@@ -140,10 +143,10 @@ eNBs =
     NETWORK_INTERFACES :
     {
         ENB_INTERFACE_NAME_FOR_S1_MME            = "eth0";
-        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.213/24";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.150/24";
 
         ENB_INTERFACE_NAME_FOR_S1U               = "eth0";
-        ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.213/24";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.150/24";
         ENB_PORT_FOR_S1U                         = 2152; # Spec 2152
     };
 
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf
index d4b88383e249fac091e2e8bbb6ecfe779398e191..a97264e3550ecfae8bd2d7e07ac4684dcf752d23 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpx310.conf
@@ -32,6 +32,7 @@ eNBs =
         Nid_cell					      = 0;
         N_RB_DL                 			      = 25;
         Nid_cell_mbsfn          			      = 0;
+        nb_antenna_ports          			      = 1;
         nb_antennas_tx          			      = 1;
         nb_antennas_rx          			      = 1;
         tx_gain                                            = 32;
@@ -96,6 +97,8 @@ eNBs =
         ue_TimersAndConstants_t311			      = 10000;
         ue_TimersAndConstants_n310			      = 20;
         ue_TimersAndConstants_n311			      = 1;
+
+	ue_TransmissionMode				      = 1;
       }
     );
 
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf
index 6e3357e49b5ee8cef961837ffeefbea21e3a29da..7941441d1da3d46964b4306643a07929770f062c 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf
@@ -17,7 +17,7 @@ eNBs =
     
     mobile_country_code =  "208";
     
-    mobile_network_code =  "92";
+    mobile_network_code =  "94";
     
        ////////// Physical parameters:
   
@@ -33,10 +33,11 @@ eNBs =
   			   Nid_cell					      = 0;
                            N_RB_DL                 			      = 25;
                            Nid_cell_mbsfn          			      = 0;
+			   nb_antenna_ports				      = 2;
                            nb_antennas_tx          			      = 2;
                            nb_antennas_rx          			      = 2; 
 			   tx_gain                                            = 90;
-			   rx_gain                                            = 132;
+			   rx_gain                                            = 125;
                            prach_root              			      = 0;
                            prach_config_index      			      = 0;
                            prach_high_speed        			      = "DISABLE";
@@ -64,9 +65,9 @@ eNBs =
 	                   srs_ackNackST                                      =;
 	                   srs_MaxUpPts                                       =;*/  
 
-	                   pusch_p0_Nominal                                   = -85; 
+	                   pusch_p0_Nominal                                   = -90; 
 	                   pusch_alpha                                        = "AL1";
-	                   pucch_p0_Nominal                                   = -108;
+	                   pucch_p0_Nominal                                   = -96;
 	                   msg3_delta_Preamble                                = 6;
 	                   pucch_deltaF_Format1                               = "deltaF2";
 	                   pucch_deltaF_Format1b                              = "deltaF3";
@@ -98,6 +99,8 @@ eNBs =
 			   ue_TimersAndConstants_n310			      = 20;
 			   ue_TimersAndConstants_n311			      = 1;
 
+			   ue_TransmissionMode	   			      = 2;
+
 			 }
 			 );
 
@@ -132,7 +135,7 @@ eNBs =
     };
     
     ////////// MME parameters:
-    mme_ip_address      = ( { ipv4       = "192.168.12.11";
+    mme_ip_address      = ( { ipv4       = "192.168.12.171";
                               ipv6       = "192:168:30::17";
                               active     = "yes";
                               preference = "ipv4";
@@ -142,10 +145,10 @@ eNBs =
     NETWORK_INTERFACES : 
     {
         ENB_INTERFACE_NAME_FOR_S1_MME            = "eth0";
-        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.213/24";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.150/24";
 
         ENB_INTERFACE_NAME_FOR_S1U               = "eth0";
-        ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.213/24";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.150/24";
         ENB_PORT_FOR_S1U                         = 2152; # Spec 2152
     };
     
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 3f419ed49ca8cfe3dc98cbd9df33a69d38e08b55..ee4344cd2d3eb8a248d4d2924ad2fd427241c4d0 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -331,7 +331,7 @@ time_stats_t softmodem_stats_tx_sf[10]; // total tx time
 time_stats_t softmodem_stats_rx_sf[10]; // total rx time
 void reset_opp_meas(void);
 void print_opp_meas(void);
-int transmission_mode=1;
+//int transmission_mode=1;
 
 int16_t           glog_level         = LOG_INFO;
 int16_t           glog_verbosity     = LOG_MED;
@@ -1272,6 +1272,28 @@ static void* eNB_thread_tx( void* param )
 
     do_OFDM_mod_rt( proc->subframe_tx, PHY_vars_eNB_g[0][proc->CC_id] );
     /*
+    if ((proc->frame_tx==100) && (proc->subframe_tx==9)) {
+      write_output("/tmp/eNBtxsig0.m","txs0",
+		   PHY_vars_eNB_g[0][proc->CC_id]->lte_eNB_common_vars.txdata[0][0],
+		   PHY_vars_eNB_g[0][proc->CC_id]->lte_frame_parms.samples_per_tti*10,
+		   1,1);
+      write_output("/tmp/eNBtxsig1.m","txs1",
+		   PHY_vars_eNB_g[0][proc->CC_id]->lte_eNB_common_vars.txdata[0][1],
+		   PHY_vars_eNB_g[0][proc->CC_id]->lte_frame_parms.samples_per_tti*10,
+		   1,1);
+      write_output("/tmp/eNBtxsigF0.m","txsF0",
+		   PHY_vars_eNB_g[0][proc->CC_id]->lte_eNB_common_vars.txdataF[0][0],
+		   PHY_vars_eNB_g[0][proc->CC_id]->lte_frame_parms.symbols_per_tti*PHY_vars_eNB_g[0][proc->CC_id]->lte_frame_parms.ofdm_symbol_size*10,
+		   1,1);
+      write_output("/tmp/eNBtxsigF1.m","txsF1",
+		   PHY_vars_eNB_g[0][proc->CC_id]->lte_eNB_common_vars.txdataF[0][1],
+		   PHY_vars_eNB_g[0][proc->CC_id]->lte_frame_parms.symbols_per_tti*PHY_vars_eNB_g[0][proc->CC_id]->lte_frame_parms.ofdm_symbol_size*10,
+		   1,1);
+
+      exit_fun("DEBUG: Exiting after writing files");
+    }
+    */
+    /*
     short *txdata = (short*)&PHY_vars_eNB_g[0][proc->CC_id]->lte_eNB_common_vars.txdata[0][0][proc->subframe_tx*PHY_vars_eNB_g[0][proc->CC_id]->lte_frame_parms.samples_per_tti];
     int i;
     for (i=0;i<PHY_vars_eNB_g[0][proc->CC_id]->lte_frame_parms.samples_per_tti*2;i+=8) {
@@ -2662,12 +2684,16 @@ static void get_options (int argc, char **argv)
       break;
 
     case 'x':
+      printf("Transmission mode should be set in config file now\n");
+      exit(-1);
+      /*
       transmission_mode = atoi(optarg);
 
       if (transmission_mode > 7) {
         printf("Transmission mode %d not supported for the moment\n",transmission_mode);
         exit(-1);
       }
+      */
       break;
 
     case 'T':
@@ -2754,7 +2780,7 @@ static void get_options (int argc, char **argv)
         frame_parms[CC_id]->N_RB_DL             =  enb_properties->properties[i]->N_RB_DL[CC_id];
         frame_parms[CC_id]->N_RB_UL             =  enb_properties->properties[i]->N_RB_DL[CC_id];
         frame_parms[CC_id]->nb_antennas_tx      =  enb_properties->properties[i]->nb_antennas_tx[CC_id];
-        frame_parms[CC_id]->nb_antennas_tx_eNB  =  enb_properties->properties[i]->nb_antennas_tx[CC_id];
+        frame_parms[CC_id]->nb_antennas_tx_eNB  =  enb_properties->properties[i]->nb_antenna_ports[CC_id];
         frame_parms[CC_id]->nb_antennas_rx      =  enb_properties->properties[i]->nb_antennas_rx[CC_id];
         //} // j
       }
@@ -3030,10 +3056,10 @@ int main( int argc, char **argv )
       //UE_flag==1
       frame_parms[CC_id]->nb_antennas_tx     = 1;
       frame_parms[CC_id]->nb_antennas_rx     = 1;
-      frame_parms[CC_id]->nb_antennas_tx_eNB = (transmission_mode == 1) ? 1 : 2; //initial value overwritten by initial sync later
+      frame_parms[CC_id]->nb_antennas_tx_eNB = 1; //initial value overwritten by initial sync later
     }
 
-    frame_parms[CC_id]->mode1_flag         = (transmission_mode == 1) ? 1 : 0;
+    frame_parms[CC_id]->mode1_flag         = (frame_parms[CC_id]->nb_antennas_tx_eNB == 1) ? 1 : 0;
     frame_parms[CC_id]->phich_config_common.phich_resource = oneSixth;
     frame_parms[CC_id]->phich_config_common.phich_duration = normal;
     // UL RS Config
@@ -3069,7 +3095,7 @@ int main( int argc, char **argv )
 
     for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
 
-      PHY_vars_UE_g[0][CC_id] = init_lte_UE(frame_parms[CC_id], 0,abstraction_flag,transmission_mode);
+      PHY_vars_UE_g[0][CC_id] = init_lte_UE(frame_parms[CC_id], 0,abstraction_flag);
       UE[CC_id] = PHY_vars_UE_g[0][CC_id];
       printf("PHY_vars_UE_g[0][%d] = %p\n",CC_id,UE[CC_id]);
 
@@ -3169,7 +3195,7 @@ int main( int argc, char **argv )
     PHY_vars_eNB_g[0] = malloc(sizeof(PHY_VARS_eNB*));
 
     for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-      PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,cooperation_flag,transmission_mode,abstraction_flag);
+      PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,cooperation_flag,abstraction_flag);
       PHY_vars_eNB_g[0][CC_id]->CC_id = CC_id;
 
       if (phy_test==1)
diff --git a/targets/SIMU/USER/init_lte.c b/targets/SIMU/USER/init_lte.c
index 861bfa6cbf9bd0eab11a964f4f584086b96a042c..0e7564565c759868ef265f9b0fff6758c57f2913 100644
--- a/targets/SIMU/USER/init_lte.c
+++ b/targets/SIMU/USER/init_lte.c
@@ -50,7 +50,6 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
                            uint8_t eNB_id,
                            uint8_t Nid_cell,
                            uint8_t cooperation_flag,
-                           uint8_t transmission_mode,
                            uint8_t abstraction_flag)
 {
 
@@ -69,7 +68,6 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
   LOG_I(PHY,"init eNB: number of ue max %d number of enb max %d number of harq pid max %d\n",
         NUMBER_OF_UE_MAX, NUMBER_OF_eNB_MAX, NUMBER_OF_HARQ_PID_MAX);
   LOG_I(PHY,"init eNB: N_RB_DL %d\n", frame_parms->N_RB_DL);
-  LOG_I(PHY,"init eNB: Transmission mode %d\n", transmission_mode);
 
   for (i=0; i<NUMBER_OF_UE_MAX; i++) {
     for (j=0; j<2; j++) {
@@ -93,7 +91,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
 
     // this is the transmission mode for the signalling channels
     // this will be overwritten with the real transmission mode by the RRC once the UE is connected
-    PHY_vars_eNB->transmission_mode[i] = transmission_mode;
+    PHY_vars_eNB->transmission_mode[i] = frame_parms->nb_antennas_tx_eNB==1 ? 1 : 2;
 #ifdef LOCALIZATION
     PHY_vars_eNB->ulsch_eNB[1+i]->aggregation_period_ms = 5000; // 5000 milliseconds // could be given as an argument (TBD))
     struct timeval ts;
@@ -153,8 +151,8 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
 
 PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,
                          uint8_t UE_id,
-                         uint8_t abstraction_flag,
-                         uint8_t transmission_mode)
+                         uint8_t abstraction_flag)
+
 {
 
   int i,j;
@@ -187,7 +185,7 @@ PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,
     PHY_vars_UE->dlsch_ue_SI[i]  = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag);
     PHY_vars_UE->dlsch_ue_ra[i]  = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag);
 
-    PHY_vars_UE->transmission_mode[i] = transmission_mode;
+    PHY_vars_UE->transmission_mode[i] = frame_parms->nb_antennas_tx_eNB==1 ? 1 : 2;
   }
 
   PHY_vars_UE->lte_frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
@@ -225,8 +223,13 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
                    uint8_t extended_prefix_flag,
                    uint8_t N_RB_DL,
                    uint16_t Nid_cell,
-                   uint8_t cooperation_flag,uint8_t transmission_mode,uint8_t abstraction_flag,
-                   int nb_antennas_rx, uint8_t eMBMS_active_state)
+                   uint8_t cooperation_flag,
+		   uint8_t nb_antenna_ports,
+		   uint8_t abstraction_flag,
+                   int nb_antennas_rx, 
+		   int nb_antennas_tx, 
+		   int nb_antennas_rx_ue,
+		   uint8_t eMBMS_active_state)
 {
 
   uint8_t eNB_id,UE_id,RN_id,CC_id;
@@ -250,10 +253,10 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
     (frame_parms[CC_id])->Ncp_UL             = extended_prefix_flag; 
     (frame_parms[CC_id])->Nid_cell           = Nid_cell;
     (frame_parms[CC_id])->nushift            = (Nid_cell%6);
-    (frame_parms[CC_id])->nb_antennas_tx     = (transmission_mode == 1) ? 1 : 2;
-    (frame_parms[CC_id])->nb_antennas_tx_eNB = (transmission_mode == 1) ? 1 : 2;
-    (frame_parms[CC_id])->nb_antennas_rx     = (transmission_mode == 1) ? 1 : 2;
-    (frame_parms[CC_id])->mode1_flag = (transmission_mode == 1) ? 1 : 0;
+    (frame_parms[CC_id])->nb_antennas_tx     = nb_antennas_tx;
+    (frame_parms[CC_id])->nb_antennas_rx     = nb_antennas_rx;
+    (frame_parms[CC_id])->nb_antennas_tx_eNB = nb_antenna_ports;
+    (frame_parms[CC_id])->mode1_flag          = (frame_parms[CC_id])->nb_antennas_tx_eNB==1 ? 1 : 0;
 
     init_frame_parms(frame_parms[CC_id],1);
 
@@ -275,7 +278,7 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
     PHY_vars_eNB_g[eNB_id] = (PHY_VARS_eNB**) malloc(MAX_NUM_CCs*sizeof(PHY_VARS_eNB*));
 
     for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-      PHY_vars_eNB_g[eNB_id][CC_id] = init_lte_eNB(frame_parms[CC_id],eNB_id,Nid_cell,cooperation_flag,transmission_mode,abstraction_flag);
+      PHY_vars_eNB_g[eNB_id][CC_id] = init_lte_eNB(frame_parms[CC_id],eNB_id,Nid_cell,cooperation_flag,abstraction_flag);
       PHY_vars_eNB_g[eNB_id][CC_id]->Mod_id=eNB_id;
       PHY_vars_eNB_g[eNB_id][CC_id]->CC_id=CC_id;
     }
@@ -289,10 +292,10 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
 
     for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
       (frame_parms[CC_id])->nb_antennas_tx     = 1;
-      (frame_parms[CC_id])->nb_antennas_rx     = nb_antennas_rx;
+      (frame_parms[CC_id])->nb_antennas_rx     = nb_antennas_rx_ue;
 
 
-      PHY_vars_UE_g[UE_id][CC_id] = init_lte_UE(frame_parms[CC_id], UE_id,abstraction_flag,transmission_mode);
+      PHY_vars_UE_g[UE_id][CC_id] = init_lte_UE(frame_parms[CC_id], UE_id,abstraction_flag);
       PHY_vars_UE_g[UE_id][CC_id]->Mod_id=UE_id;
       PHY_vars_UE_g[UE_id][CC_id]->CC_id=CC_id;
     }
diff --git a/targets/SIMU/USER/init_lte.h b/targets/SIMU/USER/init_lte.h
index b00f1f8a3c8064c677188078a724240d21c2bbcb..72ffd6076580aa7c6437d324a3e8d8f5b4f05648 100644
--- a/targets/SIMU/USER/init_lte.h
+++ b/targets/SIMU/USER/init_lte.h
@@ -34,13 +34,11 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
                            uint8_t eNB_id,
                            uint8_t Nid_cell,
                            uint8_t cooperation_flag,
-                           uint8_t transmission_mode,
                            uint8_t abstraction_flag);
 
 PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,
                          uint8_t UE_id,
-                         uint8_t abstraction_flag,
-                         uint8_t transmission_mode);
+                         uint8_t abstraction_flag);
 
 PHY_VARS_RN* init_lte_RN(LTE_DL_FRAME_PARMS *frame_parms,
                          uint8_t RN_id,
@@ -54,7 +52,9 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
                    uint8_t N_RB_DL,
                    uint16_t Nid_cell,
                    uint8_t cooperation_flag,
-                   uint8_t transmission_mode,
+                   uint8_t nb_antenna_ports,
                    uint8_t abstraction_flag,
                    int nb_antennas_rx,
+                   int nb_antennas_tx,
+                   int nb_antennas_rx_ue,
                    uint8_t eMBMS_active_state);
diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c
index 52940a5638851bb014698c138693eccd402ac55d..0213e6e96ef16ba6881187390166d04f1205b4e8 100644
--- a/targets/SIMU/USER/oaisim.c
+++ b/targets/SIMU/USER/oaisim.c
@@ -248,10 +248,13 @@ help (void)
 #else
   printf ("-W [Rohde&Schwarz SMBV100A functions disabled. Recompile with SMBV=1]\n");
 #endif
-  printf ("-x Set the transmission mode (1,2,5,6 supported for now)\n");
+  printf ("-x deprecated. Set the transmission mode in config file!\n");
+  printf ("-y Set the number of receive antennas at the UE (1 or 2)\n");
   printf ("-Y Set the global log verbosity (none, low, medium, high, full) \n");
   printf ("-z Set the cooperation flag (0 for no cooperation, 1 for delay diversity and 2 for distributed alamouti\n");
   printf ("-Z Reserved\n");
+  printf ("--xforms Activate the grapical scope\n");
+
 #if T_TRACER
   printf ("--T_port [port]    use given port\n");
   printf ("--T_nowait         don't wait for tracer, start immediately\n");
@@ -616,10 +619,20 @@ l2l1_task (void *args_p)
   }
 
 #endif
+  module_id_t enb_id;
+  module_id_t UE_id;
+  for (enb_id = 0; enb_id < NB_eNB_INST; enb_id++)
+    mac_xface->mrbch_phy_sync_failure (enb_id, 0, enb_id);
+  
+  if (abstraction_flag == 1) {
+    for (UE_id = 0; UE_id < NB_UE_INST; UE_id++)
+      mac_xface->dl_phy_sync_success (UE_id, 0, 0,1);   //UE_id%NB_eNB_INST);
+  }
+  
   start_meas (&oaisim_stats);
 
   for (frame = 0;
-       (l2l1_state != L2L1_TERMINATED) &&
+       (l2l1_state != L2L1_TERMINATED) && 
 	 ((oai_emulation.info.n_frames_flag == 0) ||
 	  (frame < oai_emulation.info.n_frames));
        frame++) {
@@ -683,8 +696,7 @@ l2l1_task (void *args_p)
     //oai_emulation.info.time_ms += 1;
     oai_emulation.info.time_s += 0.01; // emu time in s, each frame lasts for 10 ms // JNote: TODO check the coherency of the time and frame (I corrected it to 10 (instead of 0.01)
 
-    update_omg (frame); // frequency is defined in the omg_global params configurable by the user
-
+     update_omg (frame); // frequency is defined in the omg_global params configurable by the user
     update_omg_ocm ();
 
 #ifdef OPENAIR2
@@ -755,7 +767,7 @@ l2l1_task (void *args_p)
               LOG_D(EMU,
                     "PHY procedures eNB %d for frame %d, slot %d (subframe TX %d, RX %d) TDD %d/%d Nid_cell %d\n",
                     eNB_inst,
-                    frame % MAX_FRAME_NUMBER,
+                    frame%MAX_FRAME_NUMBER,
                     slot,
                     PHY_vars_eNB_g[eNB_inst][0]->proc[slot >> 1].subframe_tx,
                     PHY_vars_eNB_g[eNB_inst][0]->proc[slot >> 1].subframe_rx,
@@ -845,7 +857,6 @@ l2l1_task (void *args_p)
                     PHY_vars_UE_g[UE_inst][0]->frame_tx = frame % MAX_FRAME_NUMBER;
                   else
                     PHY_vars_UE_g[UE_inst][0]->frame_tx = (frame + 1) % MAX_FRAME_NUMBER;
-
 #ifdef OPENAIR2
                   //Application
                   update_otg_UE (UE_inst, oai_emulation.info.time_ms);
@@ -904,7 +915,7 @@ l2l1_task (void *args_p)
 
               if(last_slot==2 && frame%10==0) {
                 if (UE_stats_th[UE_inst]) {
-                  fprintf(UE_stats_th[UE_inst],"%d %d\n",frame % MAX_FRAME_NUMBER, PHY_vars_UE_g[UE_inst][0]->bitrate[0]/1000);
+                  fprintf(UE_stats_th[UE_inst],"%d %d\n",frame%MAX_FRAME_NUMBER, PHY_vars_UE_g[UE_inst][0]->bitrate[0]/1000);
                 }
               }
 
@@ -1147,7 +1158,7 @@ l2l1_task (void *args_p)
         stop_meas (&oaisim_stats_f);
     } //end of slot
 
-    if ((frame >= 10) && (frame <= 11) && (abstraction_flag == 0)
+    if ((frame >= 12) && (frame <= 12) && (abstraction_flag == 0)
 #ifdef PROC
         &&(Channel_Flag==0)
 #endif
@@ -1160,22 +1171,42 @@ l2l1_task (void *args_p)
                     PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti
                     * 10,
                     1, 1);
-      sprintf (fname, "eNBtxsig%d.m", frame % MAX_FRAME_NUMBER);
-      sprintf (vname, "txs%d", frame % MAX_FRAME_NUMBER);
+      sprintf (fname, "eNBtxsig0_%d.m", frame % MAX_FRAME_NUMBER);
+      sprintf (vname, "txs0_%d", frame % MAX_FRAME_NUMBER);
       write_output (fname,
                     vname,
                     PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.txdata[0][0],
                     PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti
                     * 10,
                     1, 1);
-      sprintf (fname, "eNBtxsigF%d.m", frame % MAX_FRAME_NUMBER);
-      sprintf (vname, "txsF%d", frame % MAX_FRAME_NUMBER);
+      if (PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx>1) {
+	sprintf (fname, "eNBtxsig1_%d.m", frame % MAX_FRAME_NUMBER);
+	sprintf (vname, "txs1_%d", frame % MAX_FRAME_NUMBER);
+	write_output (fname,
+		      vname,
+		      PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.txdata[0][0],
+		      PHY_vars_UE_g[0][0]->lte_frame_parms.samples_per_tti
+		      * 10,
+		      1, 1);
+      }
+      sprintf (fname, "eNBtxsigF0_%d.m", frame % MAX_FRAME_NUMBER);
+      sprintf (vname, "txsF0_%d", frame % MAX_FRAME_NUMBER);
       write_output (fname,
                     vname,
                     PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.txdataF[0][0],
                     PHY_vars_eNB_g[0][0]->lte_frame_parms.symbols_per_tti
-                    * PHY_vars_eNB_g[0][0]->lte_frame_parms.ofdm_symbol_size,
+                    * PHY_vars_eNB_g[0][0]->lte_frame_parms.ofdm_symbol_size*10,
                     1, 1);
+      if (PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx>1) {
+	sprintf (fname, "eNBtxsigF1_%d.m", frame % MAX_FRAME_NUMBER);
+	sprintf (vname, "txsF1_%d", frame % MAX_FRAME_NUMBER);
+	write_output (fname,
+		      vname,
+		      PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.txdataF[0][1],
+		      PHY_vars_eNB_g[0][0]->lte_frame_parms.symbols_per_tti
+		      * PHY_vars_eNB_g[0][0]->lte_frame_parms.ofdm_symbol_size *10,
+		      1, 1);
+      }
       sprintf (fname, "UErxsig%d.m", frame % MAX_FRAME_NUMBER);
       sprintf (vname, "rxs%d", frame % MAX_FRAME_NUMBER);
       write_output (fname,
diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c
index 34bc9f1d98887a510edbdc82f4f501b9fd3f09d3..06a1c436b133dfd50d23f08c9b9d0cf2435969cf 100644
--- a/targets/SIMU/USER/oaisim_functions.c
+++ b/targets/SIMU/USER/oaisim_functions.c
@@ -100,7 +100,7 @@ int           if_times              = 0;
 int           for_times             = 0;
 
 uint16_t           Nid_cell              = 0; //needed by init_lte_vars
-int           nb_antennas_rx        = 2; // //
+int           nb_antennas_rx_ue        = 1; // //
 uint8_t            target_dl_mcs         = 16; // max mcs used by MAC scheduler
 uint8_t            rate_adaptation_flag  = 0;
 uint8_t        set_snr         = 0;
@@ -173,10 +173,11 @@ extern time_stats_t ul_chan_stats;
 
 extern int xforms;
 
+const Enb_properties_array_t *enb_properties;
+
 void get_simulation_options(int argc, char *argv[])
 {
   int                           option;
-  const Enb_properties_array_t *enb_properties;
   char  *conf_config_file_name = NULL;
 
   enum long_option_e {
@@ -714,6 +715,7 @@ void get_simulation_options(int argc, char *argv[])
       break;
 
     case 'x':
+      /*
       oai_emulation.info.transmission_mode[0] = atoi (optarg);
 
       if ((oai_emulation.info.transmission_mode[0] != 1) &&  (oai_emulation.info.transmission_mode[0] != 2) && (oai_emulation.info.transmission_mode[0] != 3)
@@ -721,6 +723,9 @@ void get_simulation_options(int argc, char *argv[])
         printf("Unsupported transmission mode %d\n",oai_emulation.info.transmission_mode[0]);
         exit(-1);
       }
+      */
+      printf("Option -x deprecated. Please set transmission mode in eNB config file\n");
+      exit(-1);
 
       break;
 
@@ -745,9 +750,9 @@ void get_simulation_options(int argc, char *argv[])
       break;
 
     case 'y':
-      nb_antennas_rx=atoi(optarg);
+      nb_antennas_rx_ue=atoi(optarg);
 
-      if (nb_antennas_rx>4) {
+      if (nb_antennas_rx_ue>4) {
         printf("Cannot have more than 4 antennas\n");
         exit(-1);
       }
@@ -956,8 +961,20 @@ void init_openair1(void)
 
   // change the nb_connected_eNB
   for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    init_lte_vars (&frame_parms[CC_id], oai_emulation.info.frame_type[CC_id], oai_emulation.info.tdd_config[CC_id], oai_emulation.info.tdd_config_S[CC_id],oai_emulation.info.extended_prefix_flag[CC_id],
-                   oai_emulation.info.N_RB_DL[CC_id], Nid_cell, cooperation_flag, oai_emulation.info.transmission_mode[CC_id], abstraction_flag,nb_antennas_rx, oai_emulation.info.eMBMS_active_state);
+    init_lte_vars (&frame_parms[CC_id], 
+		   oai_emulation.info.frame_type[CC_id], 
+		   oai_emulation.info.tdd_config[CC_id], 
+		   oai_emulation.info.tdd_config_S[CC_id],
+		   oai_emulation.info.extended_prefix_flag[CC_id],
+                   oai_emulation.info.N_RB_DL[CC_id], 
+		   Nid_cell, 
+		   cooperation_flag, 
+		   enb_properties->properties[0]->nb_antenna_ports[CC_id], 
+		   abstraction_flag,
+		   enb_properties->properties[0]->nb_antennas_rx[CC_id],
+		   enb_properties->properties[0]->nb_antennas_tx[CC_id],
+		   nb_antennas_rx_ue,
+		   oai_emulation.info.eMBMS_active_state);
   }
 
   for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
@@ -1090,14 +1107,6 @@ void init_openair2(void)
              oai_emulation.info.cba_group_active,
              oai_emulation.info.handover_active);
 
-  for (enb_id = 0; enb_id < NB_eNB_INST; enb_id++)
-    mac_xface->mrbch_phy_sync_failure (enb_id, 0, enb_id);
-
-  if (abstraction_flag == 1) {
-    for (UE_id = 0; UE_id < NB_UE_INST; UE_id++)
-      mac_xface->dl_phy_sync_success (UE_id, 0, 0,1);   //UE_id%NB_eNB_INST);
-  }
-
   mac_xface->macphy_exit = exit_fun;
 
 #endif